Hi all,

There is a question that bothers me from a while.

For the sake of this example lets use "Employee" and "Customer" CMPs with 1 to M 
relationship.
Lets say Customer has fields "name", "address", "phone".

Suppose I would like to list all Customers for given Employee. Something like

customer1, address1, phone1
customer2, address2, phone2
....
customerN, addresN, phoneN


With my today's knowledge I would write appropriate finder method in "Employee" returning Collection of "Customer". Then I would iterate through this Collection, instantiate its elements and call appropriate getters to display the information I need.

For some reason though, this doesn't look like good solution for me.
As far as I understand this will call ejbLoad (and perhaps ejbStore) method for each 
and
every bean instance. I'm not sure if this will result in many SQL queries being send to
the underlaying database or it is somehow optimized.

I'm I right to thing that this approach will not take the first place in performance 
tests?
Especially if it happens that our employee has couple of thousands customers.

I've been wandering what other options I have? Going for BMP? Session bean + JDBC?

Is there something like "best practice"?


Best regards, Milen Dyankov



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to