That's exactly how it works.. The finder methods returns the collection of
primary keys and the entity beans are passivated and activated.. In the
process, it loads the bean by primary key. However, it's probably not going
to create 1000 bean, instead it probably create about 100 or less and re-use
them. If you want to return only the primary, you can do so by another
remote method to return the collection of primary keys only.. It's treated
as another remote method, not finder method. So, you can't get this unless
you have the remote object.. :-(
You can always use the stateless session bean to achieve the same result..
Se Hee
-->-----Original Message-----
-->From: A mailing list for Enterprise JavaBeans development
-->[mailto:[EMAIL PROTECTED]]On Behalf Of Sandeep Kochhar
-->Sent: Thursday, May 11, 2000 7:40 PM
-->To: [EMAIL PROTECTED]
-->Subject: Question on Finder behavior for BMP
-->
-->
-->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".
-->
-->
===========================================================================
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".