JPA 2.1 load graph without effect / fetch graph loading wrong fields [message #1099265] |
Sun, 01 September 2013 07:59  |
Eclipse User |
|
|
|
After my message http://www.eclipse.org/forums/index.php/mv/msg/489115/1063959/#msg_1063959 did not receive more answers, I isolated a test case for demonstrating the problem - see attached file. It is a Maven 3 project and should build from scratch.
It show the following effects:
a) Using a JPA 2.1 load graph does not load the attributes requested.
The entity graph Publisher_books defined on class Publisher contains the attribute books. The test method PublisherTest.testSimpleLoadGraph executes a query with javax.persistence.loadgraph set to Publisher_books, but the query result contains just an unloaded IndirectList for books.
b) Using a JPA 2.1 fetch graph does load the attributes requested, but other lazy attribute are loaded as well and contain wrong values.
The test method PublisherTest.testSimpleFetchGraph executes a query with javax.persistence.fetchgraph set to Publisher_books. Now the attribute books is indeed loaded. But the second lazy attribute - categories - is loaded as well, but with a wrong value: Instead of a list with a single entry it is an empty list. Also the id attribute id is null, whereas the spec requests id attributes to be loaded regardless of the entity graph in use.
I'm using EclipseLink 2.5.0, but 2.6.0-SNAPSHOT shows the same results.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04448 seconds