> 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".