-
- Type Parameters:
T
- The type of the root entity.
- All Superinterfaces:
Graph<T>
public interface EntityGraph<T> extends Graph<T>
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:
- 2.1
- See Also:
AttributeNode
,Subgraph
,NamedEntityGraph
,EntityManager.createEntityGraph(Class)
,EntityManager.createEntityGraph(String)
,EntityManager.getEntityGraph(String)
,EntityManagerFactory.addNamedEntityGraph(String, EntityGraph)
,EntityManager.find(EntityGraph, Object, FindOption...)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description <T> Subgraph<? extends T>
addSubclassSubgraph(java.lang.Class<? extends T> type)
Deprecated, for removal: This API element is subject to removal in a future version.<S extends T>
Subgraph<S>addTreatedSubgraph(java.lang.Class<S> type)
Add additional attributes to this entity graph that correspond to attributes of subclasses of the entity type of thisEntityGraph
.java.lang.String
getName()
Return the name of a namedEntityGraph
(an entity graph defined by means of theNamedEntityGraph
annotation, XML descriptor element, or added by means of theEntityManagerFactory.addNamedEntityGraph(java.lang.String, jakarta.persistence.EntityGraph<T>)
method).-
Methods inherited from interface jakarta.persistence.Graph
addAttributeNode, addAttributeNode, addAttributeNodes, addAttributeNodes, addElementSubgraph, addElementSubgraph, addElementSubgraph, addKeySubgraph, addKeySubgraph, addKeySubgraph, addKeySubgraph, addMapKeySubgraph, addSubgraph, addSubgraph, addSubgraph, addSubgraph, addTreatedElementSubgraph, addTreatedMapKeySubgraph, addTreatedSubgraph, getAttributeNode, getAttributeNode, getAttributeNodes, hasAttributeNode, hasAttributeNode, removeAttributeNode, removeAttributeNode, removeAttributeNodes
-
-
-
-
Method Detail
-
getName
java.lang.String getName()
Return the name of a namedEntityGraph
(an entity graph defined by means of theNamedEntityGraph
annotation, XML descriptor element, or added by means of theEntityManagerFactory.addNamedEntityGraph(java.lang.String, jakarta.persistence.EntityGraph<T>)
method). Returns null if theEntityGraph
is not a namedEntityGraph
.
-
addTreatedSubgraph
<S extends T> Subgraph<S> addTreatedSubgraph(java.lang.Class<S> type)
Add additional attributes to this entity graph that correspond to attributes of subclasses of the entity type of thisEntityGraph
. Subclass subgraphs automatically include the specified attributes of superclass subgraphs.- Parameters:
type
- entity subclass- Returns:
- subgraph for the subclass
- Throws:
java.lang.IllegalArgumentException
- if the type is not an entity typejava.lang.IllegalStateException
- if the EntityGraph has been statically defined
-
addSubclassSubgraph
@Deprecated(since="3.2", forRemoval=true) <T> Subgraph<? extends T> addSubclassSubgraph(java.lang.Class<? extends T> type)
Deprecated, for removal: This API element is subject to removal in a future version.Add additional attributes to this entity graph that correspond to attributes of subclasses of the entity type of thisEntityGraph
. Subclass subgraphs automatically include the specified attributes of superclass subgraphs.- Parameters:
type
- entity subclass- Returns:
- subgraph for the subclass
- Throws:
java.lang.IllegalArgumentException
- if the type is not an entity typejava.lang.IllegalStateException
- if the EntityGraph has been statically defined
-
-