JPA 2.1 Entity Graphs
JPA 2.1 Entity Graphs
Join the DZone community and get the full member experience.
Join For FreeDownload Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.
Entity Graphs are a very important but somewhat underrated enhancement in JPA 2.1/Java EE 7. The feature significantly improves the ability to load/fetch JPA data beyond the very coarse grained mechanism of traditional ORM lazy and eager loading. Applied correctly, entity graphs could significantly improve application performance in still a fairly elegant way. Hantsy Bai does an excellent job explaining the basics of JPA 2.1 entity graphs in a recent blog post. He demonstrates how to define an entity graph using annotations or programatically, using the entity graph in a simple query and the basic value proposition for entity graphs. Linda DeMichiel dedicated a good amount of time explaining entity graphs during her JavaOne 2013 talk on JPA 2.1 (video below).
The official Java EE 7 tutorial also has a pretty decent section on entity graphs. It is definitely worth your time to understand the feature well and apply it in your JPA applications.
Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat.
Published at DZone with permission of Reza Rahman , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}
{{ parent.urlSource.name }}