Interface EntityGraph<T>

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:
  • Method Details

    • getName

      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(java.lang.String, jakarta.persistence.EntityGraph<T>) method). Returns null if the EntityGraph is not a named EntityGraph.
    • addTreatedSubgraph

      <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 - entity subclass
      Returns:
      subgraph for the subclass
      Throws:
      IllegalArgumentException - if the type is not an entity type
      IllegalStateException - if the EntityGraph has been statically defined
    • addSubclassSubgraph

      @Deprecated(since="3.2", forRemoval=true) <T> Subgraph<? extends T> addSubclassSubgraph(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 this EntityGraph. Subclass subgraphs automatically include the specified attributes of superclass subgraphs.
      Parameters:
      type - entity subclass
      Returns:
      subgraph for the subclass
      Throws:
      IllegalArgumentException - if the type is not an entity type
      IllegalStateException - if the EntityGraph has been statically defined