Hi Dan,
        Thank you very much for that Dan, I thought I was seeing things
for second. 
Thanks especially for such a clear and lengthy description. It must have
taken you some time. 

Cheers,
Mark.



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Dan
Christopherson
Sent: 05 June 2003 17:00
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Quick Explanation.


Short answer - the BMP bean returns the keys because that's what the 
spec says to do. It really _should_ verify that the keys passed in are 
valid, but hey, it's an example!

Long answer:
That method would be exposed to clients on 
GangserHome.findByPrimaryKeys(Collection keys);

The container intercepts that method and calls the BMP custom finder. 
The contract between container and BMP entity is such that the entity 
returns _keys_ from its 'ejbFindXXX' methods - the container is 
responsible for managing the creation of entities corresponding to the
keys.

At a later point (maybe in the same transaction, maybe in a subsequent 
one - it all depends on the client code), ejbLoad will be called on any 
and all entities in the collection that are actually accessed. That is 
when the bulk of data will (should, per spec.) be loaded from the
database.

Note that this means that for most finders, the database will be hit 1 
(for the original query to determine which entities match) + N (once for

each entity) times! This leads quickly to performance problems. To avoid

this, either use CMP 2.0 entities, allowing the container to optimize 
the whole thing through read-ahead of entity data, or don't use entities

at all.

hth,
-danch

[EMAIL PROTECTED] wrote:
> Hi folks,
> 
>     This snippet is taken from the JBOSSCMP docs. I can't understand 
> how
> it returns the remote entities.It is a BMP custom finder.
> 
> public abstract class GangsterBean implements EntityBean {
> 
>     public Collection ejbFindByPrimaryKeys(Collection keys) {
> 
>             return keys;
> 
>     }
> 
> }
> 
> 
> It just seems to take in the keys collection and then return it 
> straight
> back out again.
> I'm confused cos I can't see where the container would intercept the 
> call and
> return the entities if the method is not declared abstract.
> 
>  
> 
> Thanks,
> 
> Mark.
> 




-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user



-------------------------------------------------------
This SF.net email is sponsored by:  Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to