JPA 2.1 Entity Graphs

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.


Post a Comment:
Comments are closed for this entry.