Package org.hibernate.graph
Interface Graph<J>
- All Known Subinterfaces:
GraphImplementor<J>
,RootGraph<J>
,RootGraphImplementor<J>
,SubGraph<J>
,SubGraphImplementor<J>
- All Known Implementing Classes:
AbstractGraph
,RootGraphImpl
,SubGraphImpl
A container for
AttributeNode
references.- See Also:
- API Note:
- Acts as an abstraction over the JPA-defined interfaces
EntityGraph
andSubgraph
, which have no common supertype.
-
Method Summary
Modifier and TypeMethodDescription<AJ> AttributeNode<AJ>
addAttributeNode
(PersistentAttribute<? super J, AJ> attribute) Add anAttributeNode
(with no associatedSubGraph
) to this container by attribute reference.<AJ> SubGraph<AJ>
addKeySubGraph
(String attributeName) <AJ> SubGraph<AJ>
addKeySubGraph
(String attributeName, Class<AJ> type) <AJ> SubGraph<AJ>
addKeySubGraph
(PersistentAttribute<? super J, AJ> attribute) <AJ> SubGraph<? extends AJ>
addKeySubGraph
(PersistentAttribute<? super J, AJ> attribute, Class<? extends AJ> type) default <AJ> SubGraph<AJ>
addPluralSubgraph
(PluralAttribute<? super J, ?, AJ> attribute) Add a subgraph rooted at a plural attribute, allowing further nodes to be added to the subgraph.<AJ> SubGraph<AJ>
addSubGraph
(String attributeName) Create and return a new (mutable)SubGraph
associated with the namedAttributeNode
.<AJ> SubGraph<AJ>
addSubGraph
(String attributeName, Class<AJ> type) <AJ> SubGraph<AJ>
addSubGraph
(PersistentAttribute<? super J, AJ> attribute) Create and return a new (mutable)SubGraph
associated with theAttributeNode
for the given attribute.<AJ> SubGraph<? extends AJ>
addSubGraph
(PersistentAttribute<? super J, AJ> attribute, Class<? extends AJ> type) <E> SubGraph<E>
addTreatedElementSubgraph
(PluralAttribute<? super J, ?, ? super E> attribute, Class<E> type) <K> SubGraph<K>
addTreatedMapKeySubgraph
(MapAttribute<? super J, ? super K, ?> attribute, Class<K> type) <Y> SubGraph<Y>
addTreatedSubgraph
(Attribute<? super J, ? super Y> attribute, Class<Y> type) <AJ> AttributeNode<AJ>
findAttributeNode
(String attributeName) Find an already existing AttributeNode by attributeName within this container<AJ> AttributeNode<AJ>
findAttributeNode
(PersistentAttribute<? super J, AJ> attribute) Find an already existing AttributeNode by corresponding attribute reference, within this container.List<AttributeNode<?>>
Get a list of all existing AttributeNodes within this container.List<AttributeNode<?>>
Ultimately only needed for implementingGraph.getAttributeNodes()
andGraph.getAttributeNodes()
Graphs apply only toManagedType
s.makeCopy
(boolean mutable) makeRootGraph
(String name, boolean mutable) Create a named rootGraph
if the given name is not null.makeSubGraph
(boolean mutable) Methods inherited from interface jakarta.persistence.Graph
addAttributeNode, addAttributeNode, addAttributeNodes, addAttributeNodes, addElementSubgraph, addElementSubgraph, addElementSubgraph, addKeySubgraph, addKeySubgraph, addKeySubgraph, addKeySubgraph, addMapKeySubgraph, addSubgraph, addSubgraph, addSubgraph, addSubgraph, getAttributeNode, getAttributeNode, getAttributeNodes, hasAttributeNode, hasAttributeNode, removeAttributeNode, removeAttributeNode, removeAttributeNodes
-
Method Details
-
addPluralSubgraph
Add a subgraph rooted at a plural attribute, allowing further nodes to be added to the subgraph.- Since:
- 6.3
- API Note:
- This method is missing in JPA, and nodes cannot be added in a typesafe way to subgraphs representing fetched collections
-
getGraphedType
ManagedDomainType<J> getGraphedType()Graphs apply only toManagedType
s.- Returns:
- the
ManagedType
being graphed here.
-
makeRootGraph
Create a named rootGraph
if the given name is not null.- Parameters:
mutable
- controls whether the resultingGraph
is mutable- Throws:
CannotBecomeEntityGraphException
- If the named attribute is not entity-valued
-
makeSubGraph
-
makeCopy
-
getGraphAttributeNodes
List<AttributeNode<?>> getGraphAttributeNodes()Ultimately only needed for implementingGraph.getAttributeNodes()
andGraph.getAttributeNodes()
-
findAttributeNode
Find an already existing AttributeNode by attributeName within this container -
findAttributeNode
Find an already existing AttributeNode by corresponding attribute reference, within this container. -
getAttributeNodeList
List<AttributeNode<?>> getAttributeNodeList()Get a list of all existing AttributeNodes within this container. -
addAttributeNode
Add anAttributeNode
(with no associatedSubGraph
) to this container by attribute reference. -
addSubGraph
Create and return a new (mutable)SubGraph
associated with the namedAttributeNode
.- Throws:
CannotContainSubGraphException
- API Note:
- If no such AttributeNode exists yet, it is created.
-
addSubGraph
<AJ> SubGraph<AJ> addSubGraph(String attributeName, Class<AJ> type) throws CannotContainSubGraphException - Throws:
CannotContainSubGraphException
-
addSubGraph
<AJ> SubGraph<AJ> addSubGraph(PersistentAttribute<? super J, AJ> attribute) throws CannotContainSubGraphExceptionCreate and return a new (mutable)SubGraph
associated with theAttributeNode
for the given attribute.- Throws:
CannotContainSubGraphException
- API Note:
- If no such AttributeNode exists yet, it is created.
-
addSubGraph
<AJ> SubGraph<? extends AJ> addSubGraph(PersistentAttribute<? super J, AJ> attribute, Class<? extends AJ> type) throws CannotContainSubGraphException- Throws:
CannotContainSubGraphException
-
addKeySubGraph
- Throws:
CannotContainSubGraphException
-
addKeySubGraph
<AJ> SubGraph<AJ> addKeySubGraph(String attributeName, Class<AJ> type) throws CannotContainSubGraphException - Throws:
CannotContainSubGraphException
-
addKeySubGraph
<AJ> SubGraph<AJ> addKeySubGraph(PersistentAttribute<? super J, AJ> attribute) throws CannotContainSubGraphException- Throws:
CannotContainSubGraphException
-
addKeySubGraph
<AJ> SubGraph<? extends AJ> addKeySubGraph(PersistentAttribute<? super J, AJ> attribute, Class<? extends AJ> type) throws CannotContainSubGraphException- Throws:
CannotContainSubGraphException
-
addTreatedSubgraph
- Specified by:
addTreatedSubgraph
in interfaceGraph<J>
-
addTreatedElementSubgraph
<E> SubGraph<E> addTreatedElementSubgraph(PluralAttribute<? super J, ?, ? super E> attribute, Class<E> type) - Specified by:
addTreatedElementSubgraph
in interfaceGraph<J>
-
addTreatedMapKeySubgraph
<K> SubGraph<K> addTreatedMapKeySubgraph(MapAttribute<? super J, ? super K, ?> attribute, Class<K> type) - Specified by:
addTreatedMapKeySubgraph
in interfaceGraph<J>
-