EntityGraph
- Type Parameters:
<T>
- The type of the root entity.
This type represents the root of an entity graph that will be used as a template to define the attribute nodes and boundaries of a graph of entities and entity relationships. The root must be an entity type.
The methods to add subgraphs implicitly create the corresponding attribute nodes as well; such attribute nodes should not be redundantly specified.
- Since:
- JPA 2.1
Public Methods
void addAttributeNodes(Attribute<T,?>... attribute)
- Parameters:
attribute
- attribute
- Throws:
- IllegalStateException - if the EntityGraph has been statically defined
- Since:
- JPA 2.1
void addAttributeNodes(String... attributeName)
- Parameters:
attributeName
- name of the attribute
- Throws:
- IllegalArgumentException - if the attribute is not an attribute of this entity.
- IllegalStateException - if the EntityGraph has been statically defined
- Since:
- JPA 2.1
This allows for construction of multi-node entity graphs that include related managed types.
- Parameters:
attribute
- attribute
- Return:
- subgraph for the key attribute
- Throws:
- IllegalArgumentException - if the attribute's target type is not an entity
- IllegalStateException - if this EntityGraph has been statically defined
- Since:
- JPA 2.1
This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will include the specified attributes of superclass subgraphs.
- Parameters:
attribute
- attributetype
- entity subclass
- Return:
- subgraph for the key attribute
- Throws:
- IllegalArgumentException - if the attribute's target type is not an entity
- IllegalStateException - if this EntityGraph has been statically defined
- Since:
- JPA 2.1
This allows for construction of multi-node entity graphs that include related managed types.
- Parameters:
attributeName
- name of the attribute
- Return:
- subgraph for the key attribute
- Throws:
- IllegalArgumentException - if the attribute is not an attribute of this entity.
- IllegalArgumentException - if the attribute's target type is not an entity
- IllegalStateException - if this EntityGraph has been statically defined
- IllegalArgumentException - if the attribute's target type is not an entity
- Since:
- JPA 2.1
This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs
- Parameters:
attributeName
- name of the attributetype
- entity subclass
- Return:
- subgraph for the key attribute
- Throws:
- IllegalArgumentException - if the attribute is not an attribute of this entity.
- IllegalArgumentException - if the attribute's target type is not a managed type
- IllegalStateException - if this EntityGraph has been statically defined
- IllegalArgumentException - if the attribute's target type is not a managed type
- Since:
- JPA 2.1
Subclass subgraphs will automatically include the specified attributes of superclass subgraphs.
- Parameters:
type
- entity subclass
- Return:
- subgraph for the subclass
- Throws:
- IllegalArgumentException - if the type is not an entity type
- IllegalStateException - if the EntityGraph has been statically defined
- Since:
- JPA 2.1
This allows for construction of multi-node entity graphs that include related managed types.
- Parameters:
attribute
- attribute
- Return:
- subgraph for the attribute
- Throws:
- IllegalArgumentException - if the attribute's target type is not a managed type
- IllegalStateException - if the EntityGraph has been statically defined
- Since:
- JPA 2.1
This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs.
- Parameters:
attribute
- attributetype
- entity subclass
- Return:
- subgraph for the attribute
- Throws:
- IllegalArgumentException - if the attribute's target type is not a managed type
- IllegalStateException - if the EntityGraph has been statically defined
- Since:
- JPA 2.1
This allows for construction of multi-node entity graphs that include related managed types.
- Parameters:
attributeName
- name of the attribute
- Return:
- subgraph for the attribute
- Throws:
- IllegalArgumentException - if the attribute is not an attribute of this entity.
- IllegalArgumentException - if the attribute's target type is not a managed type
- IllegalStateException - if the EntityGraph has been statically defined
- IllegalArgumentException - if the attribute's target type is not a managed type
- Since:
- JPA 2.1
This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs.
- Parameters:
attributeName
- name of the attributetype
- entity subclass
- Return:
- subgraph for the attribute
- Throws:
- IllegalArgumentException - if the attribute is not an attribute of this managed type.
- IllegalArgumentException - if the attribute's target type is not a managed type
- IllegalStateException - if this EntityGraph has been statically defined
- IllegalArgumentException - if the attribute's target type is not a managed type
- Since:
- JPA 2.1
- Return:
- attribute nodes for the annotated entity type or empty list if none have been defined
- Since:
- JPA 2.1
String getName()
Returns null if the EntityGraph is not a named EntityGraph.
- Since:
- JPA 2.1