Annotation Type NamedEntityGraph


  • @Target(TYPE)
    @Retention(RUNTIME)
    public @interface NamedEntityGraph
    The NamedEntityGraph annotation is used to define a named entity graph. The entity graph may be retrieved by name using the EntityManagerFactory interface. The entity graph may be used to specify the path and boundaries for find operations or queries. The NamedEntityGraph annotation must be applied to the entity class that forms the root of the corresponding graph of entities.
    Since:
    JPA 2.1
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      NamedAttributeNode[] attributeNodes
      The attributeNodes element lists attributes of the annotated entity class that are to be included in the entity graph.
      boolean includeAllAttributes
      The includeAllAttributes element specifies that all attributes of the annotated entity class are to be included in the entity graph.
      java.lang.String name
      The name element is used to refer to the entity graph.
      NamedSubgraph[] subclassSubgraphs
      The subclassSubgraphs element specifies a list of subgraphs that add additional attributes for subclasses of the root entity to which the annotation is applied.
      NamedSubgraph[] subgraphs
      The subgraphs element specifies a list of subgraphs, further specifying attributes that are managed types.
    • Element Detail

      • name

        java.lang.String name
        The name element is used to refer to the entity graph. It defaults to the entity name of the root entity to which the annotation is applied. Entity graph names must be unique within the persistence unit.
        Default:
        ""
      • attributeNodes

        NamedAttributeNode[] attributeNodes
        The attributeNodes element lists attributes of the annotated entity class that are to be included in the entity graph.
        Default:
        {}
      • includeAllAttributes

        boolean includeAllAttributes
        The includeAllAttributes element specifies that all attributes of the annotated entity class are to be included in the entity graph. An attributeNode element may still be used in conjunction with this element to specify a subgraph for the attribute.
        Default:
        false
      • subgraphs

        NamedSubgraph[] subgraphs
        The subgraphs element specifies a list of subgraphs, further specifying attributes that are managed types. These subgraphs are referenced by name from NamedAttributeNode definitions.
        Default:
        {}
      • subclassSubgraphs

        NamedSubgraph[] subclassSubgraphs
        The subclassSubgraphs element specifies a list of subgraphs that add additional attributes for subclasses of the root entity to which the annotation is applied.
        Default:
        {}