> -----Original Message-----
> From: Cedric Beust [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 17, 2001 19:46
> To: [EMAIL PROTECTED]
> 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()).
...
>
> Does this address your need?
>
> </weblogic>
>
How about the following problem:

Bean A is in a 1:many relationship with bean B. Now I would like that a
finder called on A would invoke two select calls, to fetch all the A's and
to fetch all the B's

for example:

aHome.findBySomeProprety(7) ->

  select a.id, a.property
  from a
  where a.property > 7

and then:

  select b.id, b.someotherfield, b.aref
  from a, b
  where a.id=b.aref
    and a.property > 7

(This would be the equivalent of a join. Alternatively, I wouldn't much mind
if the container requested a single SQL with the join)

I believe field groups require N+1 for this, am I wrong?

- Avi
--
And now for something completely different.

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