GEDOPLAN
Jakarta EE (Java EE)

JPA 2.1 Entity Graphs: We’re getting close!

Jakarta EE (Java EE)

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!

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Bitte füllen Sie dieses Feld aus.
Bitte füllen Sie dieses Feld aus.
Bitte gib eine gültige E-Mail-Adresse ein.
Sie müssen den Bedingungen zustimmen, um fortzufahren.

Autor

Diesen Artikel teilen

LinkedIn
Xing

Gibt es noch Fragen?

Fragen beantworten wir sehr gerne! Schreibe uns einfach per Kontaktformular.

Kurse

weitere Blogbeiträge

ng1516titel
Webprogrammierung

Angular 16/17: new control flow

Diese Reihe wirft einen kurzen Blick auf einige Highlights der Angular Versionen 16 und 17. Heute: control flow. Ein fantastisches…
IT-Training - GEDOPLAN
Jakarta EE (Java EE), Spring

Rest – HATEOAS + HAL

REST-Webservices sind wohl die am weitesten verbreitete Schnittstellentechnologie die im WEB zu finden ist. Dank JSON als Datenformat bietet REST…

Work Life Balance. Jobs bei Gedoplan

We are looking for you!

Lust bei GEDOPLAN mitzuarbeiten? Wir suchen immer Verstärkung – egal ob Entwickler, Dozent, Trainerberater oder für unser IT-Marketing! Schau doch einfach mal auf unsere Jobseiten! Wir freuen uns auf Dich!

Work Life Balance. Jobs bei Gedoplan

We are looking for you!

Lust bei GEDOPLAN mitzuarbeiten? Wir suchen immer Verstärkung – egal ob Entwickler, Dozent, Trainerberater oder für unser IT-Marketing! Schau doch einfach mal auf unsere Jobseiten! Wir freuen uns auf Dich!