Discussion:
[Middlegen-user] Finder Method Question
Cobble, Tim
2003-09-24 09:59:09 UTC
Permalink
All,

I am fairly new to Entity EJB's. Please forgive this sophomoric
question; which is:

What should I expect back from a findAll() method?

When inside MySQL and I type SELECT * FROM 'TABLE'; I get back all of
the data for all of the rows in the table.
The findALL() method seems to return me a class scope along with the
primary key for the class. I.E.
(peer_review_conversion.TDefectLocalHome:132)

I get this output by cycling through a while loop and doing
out.print(iter.next().toString()); in a servlet.
Is this what I am supposed to do? What is really in this collection?

I was hoping it would be a collection of TDefectLocal which has all of
my getXXX and setXXX methods.
I have looked at the middle-gen generated GUI and can't for the life of
me figure out what is going on there. Guess I can't read STRUTS.

Thanks for any clues!

Tim
Markus Härnvi
2003-09-24 10:17:08 UTC
Permalink
Hi!

The findAll() in the (local) home interface returns all entity beans remote or
local interfaces in a Collection.
Markus Härnvi
2003-09-24 10:18:02 UTC
Permalink
Hi!

The findAll() in the (local) home interface returns all entity beans remote or
local interfaces in a Collection.
Markus Härnvi
2003-09-24 10:18:02 UTC
Permalink
Hi!

The findAll() in the (local) home interface returns all entity beans remote or
local interfaces in a Collection.
Eivind Waaler
2003-09-24 11:34:06 UTC
Permalink
It returns a collection of entities representing all the rows in your
table. Typically you can use it like this:

Collection coll = personHome.findAll();
Iterator it = coll.iterator();
while (it.hasNext()) {
PersonLocal person = (PersonLocal)it.next();
System.out.println(person.getFirstName() + " " + person.getLastName());
}

Something like that.. This being the person class from the middlegen
samples.

.eivind
Post by Cobble, Tim
All,
I am fairly new to Entity EJB's. Please forgive this sophomoric
What should I expect back from a findAll() method?
When inside MySQL and I type SELECT * FROM 'TABLE'; I get back all of
the data for all of the rows in the table.
The findALL() method seems to return me a class scope along with the
primary key for the class. I.E.
(peer_review_conversion.TDefectLocalHome:132)
I get this output by cycling through a while loop and doing
out.print(iter.next().toString()); in a servlet.
Is this what I am supposed to do? What is really in this collection?
I was hoping it would be a collection of TDefectLocal which has all of
my getXXX and setXXX methods.
I have looked at the middle-gen generated GUI and can't for the life of
me figure out what is going on there. Guess I can't read STRUTS.
Thanks for any clues!
Tim
Cobble, Tim
2003-09-24 12:08:12 UTC
Permalink
WOW!

I have been trying to do that for days!
However, my cube mate happened to see that you left what findAll
returned as a collection. We had been doing Collection ejbResult = new
ArrayList();

Now that I left it as a Collection it works as expected!!!!!!!!!!!

THANKS!!!!

Tim

-----Original Message-----
From: Eivind Waaler [mailto:***@tihlde.org]
Sent: Wednesday, September 24, 2003 9:33 AM
To: middlegen-***@lists.sourceforge.net
Subject: Re: [Middlegen-user] Finder Method Question

It returns a collection of entities representing all the rows in your
table. Typically you can use it like this:

Collection coll = personHome.findAll();
Iterator it = coll.iterator();
while (it.hasNext()) {
PersonLocal person = (PersonLocal)it.next();
System.out.println(person.getFirstName() + " " +
person.getLastName());
}

Something like that.. This being the person class from the middlegen
samples.

.eivind
Post by Cobble, Tim
All,
I am fairly new to Entity EJB's. Please forgive this sophomoric
What should I expect back from a findAll() method?
When inside MySQL and I type SELECT * FROM 'TABLE'; I get back all of
the data for all of the rows in the table.
The findALL() method seems to return me a class scope along with the
primary key for the class. I.E.
(peer_review_conversion.TDefectLocalHome:132)
I get this output by cycling through a while loop and doing
out.print(iter.next().toString()); in a servlet.
Is this what I am supposed to do? What is really in this collection?
I was hoping it would be a collection of TDefectLocal which has all of
my getXXX and setXXX methods.
I have looked at the middle-gen generated GUI and can't for the life
of
Post by Cobble, Tim
me figure out what is going on there. Guess I can't read STRUTS.
Thanks for any clues!
Tim
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

Loading...