Package org.hibernate.annotations

Annotation Interface NamedEntityGraph


@Target({TYPE,PACKAGE})@Retention(RUNTIME)@Repeatable(NamedEntityGraphs.class)public @interfaceNamedEntityGraph
Defines a namedentity graph based on Hibernate'sentity graph language.

When applied to a root entity class, the root entity name is implied - e.g."title, isbn, author(name, books)"

When applied to a package, the root entity name must be specified - e.g."Book: title, isbn, author(name, books)"

Since:
7.0
See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The textual representation of the graph.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The name used to identify the entity graph in calls toSession.getEntityGraph(String).
  • Element Details

    • graph

      String graph
      The textual representation of the graph.

      When applied to a package, the syntax requires the entity name - e.g.,"Book: title, isbn, author(name, books)".

      When applied to an entity, the entity name should be omitted - e.g.,"title, isbn, author(name, books)".

      SeeGraphParser for details about the syntax.

    • name

      String name
      The name used to identify the entity graph in calls toSession.getEntityGraph(String). Entity graph names must be unique within the persistence unit.

      When applied to a root entity class, the name is optional and defaults to the entity-name of that entity.

      Default:
      ""