Gene De Lisa wrote:
> Since you asked, you get off track right there. :)
>
> Why are you thinking that ejbFindByPrimaryKey is called here. You've just
> returned the primary keys to the container so they already have them.
>
> It goes like this:
> for bmp the container calls ejbFind... to match the find... in the home. The
> ejbFind returns the pks to the container. The container then creates (or
> gets from a cache) ejbobjects and shoves the pk into them. that is for each
> pk there will be one ejbobject with the pk inside it. references to the
> ejbobjects are then returned. At this point there are no bean instances
> involved. The only sql executed was in the single ejbFind...

Perhaps(tm). :-)

It's even trickier. You're both right. And wrong. The actual find does
indeed not do much more than the single select. And that's all it *have*
to do. Now, the server might think "ok, so he's asked for a bunch of
beans. Isn't it likely that these'll actually be used very soon?", and
start *activating* these instances. Since there is no rule against this,
it might do this activation as a side-effect of the find. This will
result in a total of 1+(n-m) select calls, where n is the size of the
result of the find and m is the number of instances in that find that
were already in an active state (assuming  that the server does instance
caching; which it doesn't have to...).

If we're talking CMP, then eager find activation may be done in 1 select
call, because the server can use the data that was found to activate the
instances. Indeed, the 4.5.1 version of the WebLogic Server did this
(AFAIK; correct me if I'm wrong), so it's not purely theoretical. OTOH,
this has some rather nasty side effects such as cascading activation
(not nice).

/Rickard

--
Rickard �berg

@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.dreambean.com
Question reality

===========================================================================
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