Thanks for the prompt response on this issue.

Pinaki, I took your suggestion and explicitly added this FetchGroup to the
entity manager FetchPlan.  Initially this seemed to be working, but I am now
running into a somewhat more complex issue.  The issue manifests itself when
there is a 'container' class which has a OneToOne reference to an 'entity'
class, and the 'entity' class has a OneToMany self-reference as in my
previous example.  Here, when I first create an object graph where an
instance of the 'container' class references the same entity graph in the
previous example, I can save the graph and then load the graph and the
specified recursionDepth is being honored.  If I then delete the 'container'
object (which cascades the delete to the 'entity' graph), the delete occurs
correctly.  But, if I then create/save a new graph of objects, the
subsequent load of this new graph does not honor the recursionDepth.

It should be noted that I needed to specify FetchGroups on both the OneToOne
and OneToMany references described above in order to get the initial load of
the graph to succeed.

I have attached a new test case which reproduces this issue.  Again, thanks
in advance for any assistance that can be provided.

- Brian http://n2.nabble.com/file/n2272348/openjpa_recursion_test_v2.jar
openjpa_recursion_test_v2.jar 


Donald Woods wrote:
> 
> If you moved the @LoadFetchGroup from the getSubEntities() method to 
> where the m_subEntities property is defined, would that also work?
> 
> 
> Fetch group docs -
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_fetch_custom
> 
> 
> -Donald
> 
> 
> Pinaki Poddar wrote:
>> Hi Brain,
>>    You have defined a FetchGroup named "subEntities" with arecursion
>> depth
>> of 50 alright. But defining a fetch group does *not* activate it. The
>> fetch
>> group which is active by default is called default and includes fields of
>> basic types only. 
>>    One way to activate "subEntities" fetch group is to activate it by
>> name:
>>     OpenJPAEntityManager em = ....;
>>     em.getFetchPlan().addFetchGroup("subEntities");
>>     // and now do the em operations.
>> 
>> 
>> There are other ways to specify FetchGroups also. But let me know if the
>> quickest way works for you.
>> 
>> 
>>   
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Issue-with-FetchAttribute-recursionDepth-tp2260751p2272348.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to