Top Description Methods
jakarta.persistence

public Interface EntityGraph<T>

extends Graph<T>
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
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

Modifier and TypeMethod and Description
public <T> Subgraph<? extends T>

Returns:

subgraph for the subclass
addSubclassSubgraph
(Class<? extends T>
entity subclass
type
)
Deprecated for removal since 3.2. use addTreatedSubgraph(Class)

Add additional attributes to this entity graph that correspond to attributes of subclasses of the entity type of this EntityGraph.

public <S extends T> Subgraph<S>

Returns:

subgraph for the subclass
addTreatedSubgraph
(Class<S>
entity subclass
type
)

Add additional attributes to this entity graph that correspond to attributes of subclasses of the entity type of this EntityGraph.

public String
getName()

Return the name of a named EntityGraph (an entity graph defined by means of the NamedEntityGraph annotation, XML descriptor element, or added by means of the EntityManagerFactory#addNamedEntityGraph method).

Inherited from jakarta.persistence.Graph:
addAttributeNodeaddAttributeNodeaddAttributeNodesaddAttributeNodesaddElementSubgraphaddElementSubgraphaddElementSubgraphaddKeySubgraphaddKeySubgraphaddKeySubgraphaddKeySubgraphaddMapKeySubgraphaddSubgraphaddSubgraphaddSubgraphaddSubgraphaddTreatedElementSubgraphaddTreatedMapKeySubgraphaddTreatedSubgraphgetAttributeNodegetAttributeNodegetAttributeNodeshasAttributeNodehasAttributeNoderemoveAttributeNoderemoveAttributeNoderemoveAttributeNodes

Method Detail

addSubclassSubgraphback to summary
public <T> Subgraph<? extends T> addSubclassSubgraph(Class<? extends T> type)

Deprecated

for removal since 3.2.

use addTreatedSubgraph(Class)

Add additional attributes to this entity graph that correspond to attributes of subclasses of the entity type of this EntityGraph. Subclass subgraphs automatically include the specified attributes of superclass subgraphs.

Parameters
type:Class<? extends T>

entity subclass

Returns:Subgraph<? extends T>

subgraph for the subclass

Annotations
@Deprecated
since:3.2
forRemoval:true
Exceptions
IllegalArgumentException:
if the type is not an entity type
IllegalStateException:
if the EntityGraph has been statically defined
addTreatedSubgraphback to summary
public <S extends T> Subgraph<S> addTreatedSubgraph(Class<S> type)

Add additional attributes to this entity graph that correspond to attributes of subclasses of the entity type of this EntityGraph. Subclass subgraphs automatically include the specified attributes of superclass subgraphs.

Parameters
type:Class<S>

entity subclass

Returns:Subgraph<S>

subgraph for the subclass

Exceptions
IllegalArgumentException:
if the type is not an entity type
IllegalStateException:
if the EntityGraph has been statically defined
getNameback to summary
public String getName()

Return the name of a named EntityGraph (an entity graph defined by means of the NamedEntityGraph annotation, XML descriptor element, or added by means of the EntityManagerFactory#addNamedEntityGraph method). Returns null if the EntityGraph is not a named EntityGraph.