Adena Galinsky wrote:
> Hi everyone,
> Everything I've been reading seems to indicate that calling the find methods
> in entity beans just wastes time and resources. They seem to recommend
> writing find methods in session beans, which issue JDBC calls directly and
> return an array of primary keys.
You should check your sources, IMHO.
If all you want is an array of primary keys, the I don't think your home-made
finder will perform substantially faster than the entity bean finder.
On the other hand, if you want to load the state for the whole collection of
beans, then yes, using a basic finder is not efficient, since it will make
* 1 DB call to get the collection of primary keys
* n DB call to load the state for each bean
* n DB calls to store back the state of each bean.
However, any decent AppServer should help you avoiding the last n DB calls by
detecting read-only methods, either automatically, either with some help from
your part.
Moreover, if you're using CMP, the CMP engine should be smart enough to let you
specify that you want the finder to load the whole state, and not just the PKs.
In this case, you still use entity beans witout custom JDBC code, and you have
only 1 DB call.
JB.
> Given that this is faster and lighter
> weight, why would we ever write a find method in an entity bean which
> returns more than one instance of a bean?
> -Adena
>
> ===========================================================================
> 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".
--
Jean-Baptiste Nizet
[EMAIL PROTECTED]
R&D Engineer, S1 Belgium
Kleine Kloosterstraat, 23
B-1932 Sint-Stevens Woluwe
+32 2 200 45 42
===========================================================================
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".