Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » JPA 2.1 load graph without effect / fetch graph loading wrong fields
JPA 2.1 load graph without effect / fetch graph loading wrong fields [message #1099265] Sun, 01 September 2013 11:59 Go to next message
Dirk Weil is currently offline Dirk WeilFriend
Messages: 8
Registered: June 2013
Junior Member
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.
Re: JPA 2.1 load graph without effect / fetch graph loading wrong fields [message #1099384 is a reply to message #1099265] Sun, 01 September 2013 16:19 Go to previous message
Dirk Weil is currently offline Dirk WeilFriend
Messages: 8
Registered: June 2013
Junior Member
One additional note: If you declare Publisher.categories EAGER, it would be fetched in scenario b, even if not part of the fetch graph. I guess that would be OK with respect to the spec, but is obviously not expected.
Previous Topic:JPA 2.1 load/fetch graph without effect
Next Topic:Correct usage of Partitioning annotations
Goto Forum:
  


Current Time: Fri Nov 21 02:49:03 GMT 2014

Powered by FUDForum. Page generated in 0.02347 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software