All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hibernate.graph.Graph Maven / Gradle / Ivy

There is a newer version: 6.6.2.Final
Show newest version
/*
 * Hibernate, Relational Persistence for Idiomatic Java
 *
 * License: GNU Lesser General Public License (LGPL), version 2.1 or later
 * See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html
 */
package org.hibernate.graph;

import java.util.List;

import org.hibernate.metamodel.model.domain.ManagedDomainType;
import org.hibernate.metamodel.model.domain.PersistentAttribute;

/**
 * A container for {@link AttributeNode} references.
 * 

* Acts as a "bridge" between JPA's {@link jakarta.persistence.EntityGraph} * and {@link jakarta.persistence.Subgraph}. * * @author Strong Liu * @author Steve Ebersole * @author Andrea Boriero */ @SuppressWarnings({"unused", "UnusedReturnValue"}) public interface Graph extends GraphNode { /** * Graphs apply only to {@link jakarta.persistence.metamodel.ManagedType}s. * * @return the {@code ManagedType} being graphed here. */ ManagedDomainType getGraphedType(); /** * Create a named root {@link Graph} if the given name is not null. * * @param mutable controls whether the resulting {@code Graph} is mutable * * @throws CannotBecomeEntityGraphException If the named attribute is not entity-valued */ RootGraph makeRootGraph(String name, boolean mutable) throws CannotBecomeEntityGraphException; /** * Create a (mutable or immutable) {@link SubGraph} rooted at this {@link Graph}. */ SubGraph makeSubGraph(boolean mutable); @Override Graph makeCopy(boolean mutable); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // AttributeNode handling /** * Ultimately only needed for implementing {@link jakarta.persistence.EntityGraph#getAttributeNodes()} * and {@link jakarta.persistence.Subgraph#getAttributeNodes()} */ List> getGraphAttributeNodes(); /** * Find an already existing AttributeNode by attributeName within this * container */ AttributeNode findAttributeNode(String attributeName); /** * Find an already existing AttributeNode by corresponding attribute * reference, within this container */ AttributeNode findAttributeNode(PersistentAttribute attribute); /** * Get a list of all existing AttributeNodes within this container */ List> getAttributeNodeList(); /** * Add an AttributeNode (with no associated SubGraphNodes) to this container * by attribute name */ AttributeNode addAttributeNode(String attributeName); /** * Add an AttributeNode (with no associated SubGraphNode) to this container * by Attribute reference */ AttributeNode addAttributeNode(PersistentAttribute attribute); // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // sub graph nodes /** * Create a (mutable) SubGraphNode associated with the named AttributeNode. * The created SubGraphNode is returned * * @apiNote If no such AttributeNode exists yet, it is created. */ SubGraph addSubGraph(String attributeName) throws CannotContainSubGraphException; SubGraph addSubGraph(String attributeName, Class type) throws CannotContainSubGraphException; /** * Create a (mutable) SubGraphNode associated with the AttributeNode for the given * Attribute. The created SubGraphNode is returned * * @apiNote If no such AttributeNode exists yet, it is created. */ SubGraph addSubGraph(PersistentAttribute attribute) throws CannotContainSubGraphException; SubGraph addSubGraph(PersistentAttribute attribute, Class type) throws CannotContainSubGraphException; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // key sub graph nodes SubGraph addKeySubGraph(String attributeName) throws CannotContainSubGraphException; SubGraph addKeySubGraph(String attributeName, Class type) throws CannotContainSubGraphException; SubGraph addKeySubGraph(PersistentAttribute attribute) throws CannotContainSubGraphException; SubGraph addKeySubGraph(PersistentAttribute attribute, Class type) throws CannotContainSubGraphException; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy