JPA Fetch Graphs Annotations
Named entity graphs provide a static mechanism for defining fetch plans using annotations on entity classes. These graphs optimize database performance by specifying which attributes and relationships should be loaded eagerly, overriding default lazy loading behavior.
Graph Definitions
Define named entity graphs at the class level using the following annotations:
Specifies a named entity graph. It is defined on an entity class and contains a list of attribute nodes that constitute the fetch plan.
A container annotation used to group multiple @NamedEntityGraph definitions on a single entity class.
Graph Structure
Construct the internal structure of a graph by defining individual nodes and nested relationships:
Specifies an individual attribute node within a named entity graph or subgraph. It indicates that the specific attribute should be included in the fetch plan.
Defines a nested graph that allows the fetch plan to traverse relationships. A named subgraph is referenced by a NamedAttributeNode to define how the related entity's attributes should be fetched.