javax.persistence

Interface EntityGraph<T>

  • Type Parameters:
    T - The type of the root entity.

    public interface EntityGraph<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:
    Java Persistence 2.1
    See Also:
    AttributeNode, Subgraph, NamedEntityGraph
    • Method Detail

      • 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 addNamedEntityGraph method. Returns null if the EntityGraph is not a named EntityGraph.
      • addAttributeNodes

        void addAttributeNodes(String... attributeName)
        Add one or more attribute nodes to the entity graph.
        Parameters:
        attributeName - name of the attribute
        Throws:
        IllegalArgumentException - if the attribute is not an attribute of this entity.
        IllegalStateException - if the EntityGraph has been statically defined
      • addAttributeNodes

        void addAttributeNodes(Attribute<T,?>... attribute)
        Add one or more attribute nodes to the entity graph.
        Parameters:
        attribute - attribute
        Throws:
        IllegalStateException - if the EntityGraph has been statically defined
      • addSubgraph

        <X> Subgraph<X> addSubgraph(Attribute<T,X> attribute)
        Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attribute - attribute
        Returns:
        subgraph for the attribute
        Throws:
        IllegalArgumentException - if the attribute's target type is not a managed type
        IllegalStateException - if the EntityGraph has been statically defined
      • addSubgraph

        <X> Subgraph<? extends X> addSubgraph(Attribute<T,X> attribute,
                                              Class<? extends X> type)
        Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs.
        Parameters:
        attribute - attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        IllegalArgumentException - if the attribute's target type is not a managed type
        IllegalStateException - if the EntityGraph has been statically defined
      • addSubgraph

        <X> Subgraph<X> addSubgraph(String attributeName)
        Add a node to the graph that corresponds to a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attributeName - name of the attribute
        Returns:
        subgraph for the attribute
        Throws:
        IllegalArgumentException - if the attribute is not an attribute of this entity.
        IllegalArgumentException - if the attribute's target type is not a managed type
        IllegalStateException - if the EntityGraph has been statically defined
      • addSubgraph

        <X> Subgraph<X> addSubgraph(String attributeName,
                                    Class<X> type)
        Add a node to the graph that corresponds to a managed type with inheritance. This allows for multiple subclass subgraphs to be defined for this node of the entity graph. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs.
        Parameters:
        attributeName - name of the attribute
        type - entity subclass
        Returns:
        subgraph for the attribute
        Throws:
        IllegalArgumentException - if the attribute is not an attribute of this managed type.
        IllegalArgumentException - if the attribute's target type is not a managed type
        IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        <X> Subgraph<X> addKeySubgraph(Attribute<T,X> attribute)
        Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attribute - attribute
        Returns:
        subgraph for the key attribute
        Throws:
        IllegalArgumentException - if the attribute's target type is not an entity
        IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        <X> Subgraph<? extends X> addKeySubgraph(Attribute<T,X> attribute,
                                                 Class<? extends X> type)
        Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will include the specified attributes of superclass subgraphs.
        Parameters:
        attribute - attribute
        type - entity subclass
        Returns:
        subgraph for the key attribute
        Throws:
        IllegalArgumentException - if the attribute's target type is not an entity
        IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        <X> Subgraph<X> addKeySubgraph(String attributeName)
        Add a node to the graph that corresponds to a map key that is a managed type. This allows for construction of multi-node entity graphs that include related managed types.
        Parameters:
        attributeName - name of the attribute
        Returns:
        subgraph for the key attribute
        Throws:
        IllegalArgumentException - if the attribute is not an attribute of this entity.
        IllegalArgumentException - if the attribute's target type is not an entity
        IllegalStateException - if this EntityGraph has been statically defined
      • addKeySubgraph

        <X> Subgraph<X> addKeySubgraph(String attributeName,
                                       Class<X> type)
        Add a node to the graph that corresponds to a map key that is a managed type with inheritance. This allows for construction of multi-node entity graphs that include related managed types. Subclass subgraphs will automatically include the specified attributes of superclass subgraphs
        Parameters:
        attributeName - name of the attribute
        type - entity subclass
        Returns:
        subgraph for the key attribute
        Throws:
        IllegalArgumentException - if the attribute is not an attribute of this entity.
        IllegalArgumentException - if the attribute's target type is not a managed type
        IllegalStateException - if this EntityGraph has been statically defined
      • addSubclassSubgraph

        <T> Subgraph<? extends T> addSubclassSubgraph(Class<? extends T> type)
        Add additional attributes to this entity graph that correspond to attributes of subclasses of this EntityGraph's entity type. Subclass subgraphs will 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
      • getAttributeNodes

        List<AttributeNode<?>> getAttributeNodes()
        Return the attribute nodes of this entity that are included in the entity graph.
        Returns:
        attribute nodes for the annotated entity type or empty list if none have been defined

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/persistence/EntityGraph.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com, EntityGraph (Java(TM) EE 7 Specification APIs)

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.