Jakarta Persistence (JPA) Interface

jakarta.persistence.Subgraph<T>

Type Parameters:
<T> - The type of the attribute.
Super Interfaces:
Graph<T>

This type represents a subgraph for an attribute node that corresponds to a managed type. Using this class, an entity subgraph can be embedded within an EntityGraph<T>.
See Also:
Since:
Jakarta Persistence (JPA) 2.1

Public Instance Methods

AttributeNode<Y> addAttributeNode(String attributeName)
Get an existing attribute node for the attribute with the given name, or add a new attribute node if there is no existing node.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Returns:
the attribute node.
Throws:
IllegalStateException - if the EntityGraph has been statically defined.
IllegalArgumentException - if the attribute is not an attribute of this entity..
Since:
Jakarta Persistence (JPA) 3.2
Get an existing attribute node for the given attribute, or add a new attribute node if there is no existing node.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
the attribute node.
Throws:
IllegalStateException - if the EntityGraph has been statically defined.
Since:
Jakarta Persistence (JPA) 3.2
void addAttributeNodes(String... attributeName)
Add one or more attribute nodes to the entity graph.
If there is already an existing node for one of the given attribute names, that particular argument is ignored and has no effect.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Throws:
IllegalStateException - if the EntityGraph has been statically defined.
IllegalArgumentException - if the attribute is not an attribute of this managed type..
Since:
Jakarta Persistence (JPA) 1.0
Add one or more attribute nodes to the entity graph.
If there is already an existing node for one of the given attributes, that particular argument is ignored and has no effect.
Inherited from Graph<T>
Parameters:
attribute - attribute
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
Since:
Jakarta Persistence (JPA) 1.0
Add a node to the graph that corresponds to a collection element that is a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
subgraph for the element attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not an entity.
Since:
Jakarta Persistence (JPA) 3.2
Subgraph<X> addElementSubgraph(String attributeName)
Add a node to the graph that corresponds to a collection element that is a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Returns:
subgraph for the element attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 1.0
Subgraph<X> addElementSubgraph(String attributeName, Class<X> type)
Add a node to the graph that corresponds to a collection element that is a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
type - entity subclass
Returns:
subgraph for the element attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 1.0
Add a node to the graph that corresponds to a map key that is a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
subgraph for the key attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type entity.
Deprecated:
use Graph.addMapKeySubgraph
Since:
Jakarta Persistence (JPA) 1.0
Subgraph<? extends X> addKeySubgraph(Attribute<? super T,X> attribute, Class<? extends X> type)
Add a node to the graph that corresponds to a map key that is a managed type with inheritance.
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
Inherited from Graph<T>
Parameters:
attribute - attribute
type - entity subclass
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type entity.
Deprecated:
use Graph.addTreatedMapKeySubgraph
Since:
Jakarta Persistence (JPA) 1.0
Subgraph<X> addKeySubgraph(String attributeName)
Add a node to the graph that corresponds to a map key that is a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Returns:
subgraph for the key attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 1.0
Subgraph<X> addKeySubgraph(String attributeName, Class<X> type)
Add a node to the graph that corresponds to a map key that is a managed type with inheritance.
This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will include the specified attributes of superclass subgraphs
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
type - entity subclass
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 1.0
Add a node to the graph that corresponds to a map key that is a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
subgraph for the key attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type entity.
Since:
Jakarta Persistence (JPA) 1.0
Add a node to the graph that corresponds to a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if the EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 1.0
Subgraph<? extends X> addSubgraph(Attribute<? super T,X> attribute, Class<? extends X> type)
Add a node to the graph that corresponds to a managed type with inheritance.
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
Inherited from Graph<T>
Parameters:
attribute - attribute
type - entity subclass
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Deprecated:
use Graph.addTreatedSubgraph
Since:
Jakarta Persistence (JPA) 1.0
Subgraph<X> addSubgraph(String attributeName)
Add a node to the graph that corresponds to a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 1.0
Subgraph<X> addSubgraph(String attributeName, Class<X> type)
Add a node to the graph that corresponds to a managed type with inheritance.
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
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
type - entity subclass
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 1.0
Add a node to the graph that corresponds to a collection element that is a managed type.
This allows for construction of multi-node entity graphs that include related managed types.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
subgraph for the element attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not an entity.
Since:
Jakarta Persistence (JPA) 3.2
Add a node to the graph that corresponds to a map key that is a managed type with inheritance.
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
Inherited from Graph<T>
Parameters:
attribute - attribute
type - entity subclass
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if this EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type entity.
Since:
Jakarta Persistence (JPA) 1.0
Add a node to the graph that corresponds to a managed type with inheritance.
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.
Inherited from Graph<T>
Parameters:
attribute - attribute
type - entity subclass
Returns:
subgraph for the attribute.
Throws:
IllegalStateException - if the EntityGraph has been statically defined.
IllegalArgumentException - if the attribute's target type is not a managed type.
Since:
Jakarta Persistence (JPA) 3.2
AttributeNode<Y> getAttributeNode(String attributeName)
Get an existing attribute node for the attribute with the given name.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Returns:
the attribute node.
Throws:
IllegalArgumentException - if the attribute is not an attribute of this entity..
NoSuchElementException - if there is no existing node for the attribute.
Since:
Jakarta Persistence (JPA) 3.2
Get an existing attribute node for the given attribute.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
the attribute node.
Throws:
NoSuchElementException - if there is no existing node for the attribute.
Since:
Jakarta Persistence (JPA) 3.2
Return the attribute nodes corresponding to the attributes of this managed type that are included in the graph.
Inherited from Graph<T>
Returns:
list of attribute nodes included in the graph or an empty list if none have been defined.
Since:
Jakarta Persistence (JPA) 1.0
Class<T> getClassType()
Return the type for which this subgraph was defined.
Returns:
managed type referenced by the subgraph.
Since:
Jakarta Persistence (JPA) 1.0
boolean hasAttributeNode(String attributeName)
Determine if there is an existing attribute node for the attribute with the given name.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Returns:
true if there is an existing attribute node.
Throws:
IllegalArgumentException - if the attribute is not an attribute of this entity..
Since:
Jakarta Persistence (JPA) 3.2
Determine if there is an existing attribute node for the given attribute.
Inherited from Graph<T>
Parameters:
attribute - attribute
Returns:
true if there is an existing attribute node.
Since:
Jakarta Persistence (JPA) 3.2
void removeAttributeNode(String attributeName)
Remove an attribute node from the entity graph.
When this graph is interpreted as a load graph, this operation suppresses inclusion of an attribute mapped for eager fetching. The effect of this call may be overridden by subsequent invocations of Graph.addAttributeNode or Graph.addSubgraph. If there is no existing node for the given attribute name, this operation has no effect.
Inherited from Graph<T>
Parameters:
attributeName - name of the attribute
Since:
Jakarta Persistence (JPA) 3.2
Remove an attribute node from the entity graph.
When this graph is interpreted as a load graph, this operation suppresses inclusion of an attribute mapped for eager fetching. The effect of this call may be overridden by subsequent invocations of Graph.addAttributeNode or Graph.addSubgraph. If there is no existing node for the given attribute, this operation has no effect.
Inherited from Graph<T>
Parameters:
attribute - attribute
Since:
Jakarta Persistence (JPA) 3.2
Remove all attribute nodes of the given attribute types.
When this graph is interpreted as a load graph, this operation suppresses inclusion of attributes mapped for eager fetching. The effect of this call may be overridden by subsequent invocations of Graph.addAttributeNode or Graph.addSubgraph.
Inherited from Graph<T>
Since:
Jakarta Persistence (JPA) 3.2