On Tue, Apr 7, 2009 at 1:11 AM, Jay McHugh <[email protected]> wrote:

>
> If that doesn't work - or you (cannot/do not want to) eagerly fetch
> the relationship all of the time - a quick stab at what using fetch
> groups might look like this:
>
> <example>
>
> // assuming you already have an entity manager named 'entityManager'
> OpenJPAEntityManager em = OpenJPAPersistence.cast(entityManager);
>
> FetchPlan plan = em.getFetchPlan();
> plan.addField(GrandParent.class, "parents");
> plan.addField(Parent.class, "children");
>
> Query query = em.createQuery("select gp from GrandParent as gp");
>
> </example>
>

Ah, so modifying the fetch plan is for the lifetime of the em? I think I
like that. Thanks for the help.

-- 
Daryl Stultz
_____________________________________
6 Degrees Software and Consulting, Inc.
http://www.6degrees.com
mailto:[email protected]

Reply via email to