But there is one major difference. For the entity bean finder you will have
N (n=rows) instances of an entity bean (and possible N*users) in memory for
every row. Whereas one stateless session bean may be able to service
multiple users and does not need one instance for every row. Each instance
is a space in memory.
IMHO I always use a session bean to find and an entity bean to change.
Dave Wolf
Internet Applications Division
Sybase
> -----Original Message-----
> From: A mailing list for Enterprise JavaBeans development
> [mailto:[EMAIL PROTECTED]]On Behalf Of Jean-Baptiste Nizet
> Sent: Monday, August 28, 2000 12:26 PM
> To: [EMAIL PROTECTED]
> Subject: Re: Does it ever make sense to put a multi-bean-returning find
> methodin an entity bean?
>
>
> 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".
>
>
===========================================================================
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".