Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.2.0
-
None
-
None
-
None
-
JDK: Sun 1.6
Database: Derby 10.2.2.0
OS: Windows XP
Description
I am attempting to leverage the recursionDepth FetchAttribute on a couple of related JPA entity classes, but OpenJPA does not seem to be honoring the value in a certain scenario. Even if I specify a recursionDepth of 50, a load of the object graph is only returning a recursionDepth of 1 in this scenario.
The issue I'm seeing manifests itself when there is a 'container' class which has a OneToOne reference to an 'entity' class, and the 'entity' class has a OneToMany recursive self-reference . Here, when I first create an object graph where an instance of the 'container' class references a 3 level entity graph, 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. I have explicitly added the relevant FetchGroups to the entity manager FetchPlan.
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. Also, it should be noted that this seemed to work correctly with OpenJPA 1.0.0.
The attached jar file contains a simple JUnit test case which illustrates this behavior. The test case can be run using maven by unjarring the attached file and running:
mvn install
in the openjpa_recursion_test/ directory. There are comments in the test code which further describe the issue. If any additional information is needed, please let me know. Thanks.
Attachments
Attachments
Issue Links
- relates to
-
OPENJPA-944 FetchAttribute.recursionDepth = -1 does not load properly self referenced entities in a complex relation
- Closed