Yes, I know in my first post I mixed two things up a bit. The question had
to do with CMP beans which I'm not familiar... I've seen the fat key
pattern.
Cheers
-----Original Message-----
From: Gene Chuang
To: [EMAIL PROTECTED]
Sent: 5/17/01 1:23 PM
Subject: Re: CMP relationships in EJB2.0
Hi Jay,
Under current ejb spec (1.1 and 2.0), NO vendor can possibly provide BMP
eager fetch simply because the bean developer defines the fine-grained
fetch
statements in ejbLoad and the container cannot possibly "aggregate" the
sql
stmts. This is in contrast to CMP, where since the container constructs
the
sql stmts, the container can optimize them as well.
There is an alternative in case you missed it the first time, I posted
the
BMP FatKey pattern on theserverside; you'll see extensive discussions
of
this very topic on this thread.
http://www.theserverside.com/patterns/thread.jsp?thread_id=4540
Gene
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Jay Walters
Sent: Thursday, May 17, 2001 9:53 AM
To: [EMAIL PROTECTED]
Subject: Re: CMP relationships in EJB2.0
Sorry for the following...
<vendor-question>
Actually I use BMP, but what I was trying to get to was loading the
state in
the finder and caching it until it's needed by the bean. Does Weblogic
support eager fetch on the finder, or must it be 1 at a time?
</vendor-question>
Cheers
-----Original Message-----
From: Cedric Beust
To: Jay Walters; [EMAIL PROTECTED]
Sent: 5/17/01 12:46 PM
Subject: RE: CMP relationships in EJB2.0
> From: Jay Walters [mailto:[EMAIL PROTECTED]]
> I can imagine wanting to eager load attributes and relationships under
> certain circumstances, for example the N+1 query problem. If all
> loads were lazy I'd always get N+1 queries to load N beans. If I
could
configure it
> for eager load then I could also load N beans in 1 query.
<weblogic>
Field Groups allow you to do just that (actually, they go further than
what
you're asking for).
By default, all the fields are part of the same group, which means that
as
soon as one is fetched from the database, all the others are fetched as
well. This is roughly equivalent to the EJB 1.1 way (the fields are
eager-loaded, except that the loading is performed on the first get(),
not
on ejbLoad()).
If this is undesirable, you can fine tune the fetches by grouping
fields.
Then, only those fields that are part of the same group are loaded on
the
first get().
For example, if you define fields firstName, lastName and middleName to
be
part of the same group, then the first call to either of
getFirstName(),
getLastName() or getMiddleName() will cause the three fields to be
fetched
in the same query.
Does this address your need?
</weblogic>
--
Cedric
========================================================================
===
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".
===========================================================================
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".