Read FetchPlan/FetchGroup [1] in OpenJPA documentation -- that will let you specify the shape of a subgraph closure from a root instance exactly the way you want. Notice two aspects MaxFetchDepth and RecursionDepth.
[1] http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_fetch KARR, DAVID (ATTCINW) wrote: > > Let's say that I have an entity called "Category" in a composition > relationship with itself. The depth of these relationships won't be > very deep, perhaps 2-3 deep at the most. I'm considering whether it's > possible to efficiently retrieve the entire composition tree with eager > fetches, even if these relationships are lazy by default. I know I can > fetch one level at a time in an eager fashion, but is there any way to > have a single query assemble more than one level, or the entire > composition tree? > > ----- Pinaki -- View this message in context: http://n2.nabble.com/Ideas-for-fetching-shallow-composition-tree-tp4134044p4143542.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
