hi!
I have a question on the behavior of (non-primary-key) finders (e.g., findAll) for an 
entity bean, using BMP.  Typically, I want to retrieve just the primary keys of the 
entity beans satisfying the finder condition.  In my BMP code, I perform the SQL query 
and return the primary keys as a Collection.

On the client side, (as per the EJB spec), I am handed a collection of remote 
interfaces.   This seems very inefficient to me, since to show the user the primary 
keys (database rows) satisfying the query, I have to go through the Collection, 
retrieve/cast each element as the remote interface, and do a getPrimaryKey( ) on it.  
If I'm going to get a 1000 keys back, along the way, it seems the container ends up 
creating a 1000 bean instances.

Is this what's really happening: My SQL query / BMP returns a Collection of keys, the 
container instantiates that many beans, and my client code is forced to call 
getPrimaryKey to get back the results of what my BMP finder had in the first place.

This also seems very inefficient... is that the intent of the EJB spec? Wouldn't it 
make more sense if the finder returned a collection of keys?

(The same argument would apply to CMP too, I suppose.)


thanks.

--
_____________________________________
Sandeep Kochhar
Elytics.com, 238 Broadway, Cambridge, MA 02139
Tel: 617-492-7046; Fax: 617-492-6220
mailto:[EMAIL PROTECTED]
http://www.elytics.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to