EclipseLink and Hibernate are implementing JPA 2.1 entity graphs to a hight degree, but some issues are still open. I’ve tested with EclipseLink 2.5.1 and Hibernate 4.3.0.CR1. EclipseLink passes 15 of 19 tests, Hibernate even 17 of 19.
Open issues in EclipseLink:
- Fetch graphs specified by name are not found.
(Test: testHintWithFetchGraphAsString)
Interesting: Load graphs work! - Fetch and load graphs do not force loading their attributes for simple entity graphs.
(Tests: testQueryWithBasicFetchGraphLoadsGraph, testQueryWithBasicLoadGraphLoadsGraph)
Astonishingly complex entity graphs work. - If a query uses an entity graph with the hint „javax.persistence.fetchgraph“, the provider should fetch only those attributes included in the entity graph (and id and version values). So attributes not included in the graph should stay unloaded, even if they are declared EAGER. EclipseLink fetches those attributes.
(Test: testQueryWithBasicFetchGraphLoadsOther)
Again the same test with a complex graph works.
Open issues in Hibernate (2 tests fail, but for the same reason):
- If a query uses an entity graph with the hint „javax.persistence.fetchgraph“, the provider should fetch only those attributes included in the entity graph (and id and version values). So attributes not included in the graph should stay unloaded, even if they are declared EAGER. Hibernate fetches those attributes.
(Tests: testQueryWithBasicFetchGraphLoadsOther and testQueryWithComplexFetchGraphLoadsOther. In both tests the attribute Publisher.categories is not part of the entity graph, but gets loaded nevertheless.)
The test source is on GitHub: https://github.com/dirkweil/jpa-entitygraph-test.
So were getting close to what the spec proposes, but there is still a way to go. Hibernate has the edge on EclipseLink even though it is only a release candidate – good work!