Package org.hibernate.graph
Class EntityGraphs
java.lang.Object
org.hibernate.graph.EntityGraphs
A collection of
EntityGraph utilities.- Author:
- asusnjar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanareEqual(AttributeNode<?> a, AttributeNode<?> b) Compares two entity graph attribute node and returnstrueif they are equal, ignoring subgraph attribute order.static <T> booleanareEqual(EntityGraph<T> a, EntityGraph<T> b) Compares two entity graphs and returnstrueif they are equal, ignoring attribute order.static booleanCompares two entity subgraphs and returnstrueif they are equal, ignoring attribute order.static booleanCompares two entity subgraph maps and returnstrueif they are equal, ignoring order.static ListexecuteList(Query query, EntityGraph graph) Convenience method for executing the query using the givenEntityGraph.static ListexecuteList(Query query, EntityGraph graph, String semanticJpaHintName) Convenience method for executing the query, applying the givenEntityGraphusing the named semantic using JPA's "hint name".static ListexecuteList(Query query, EntityGraph graph, GraphSemantic semantic) Convenience method for executing the query, applying the givenEntityGraphusing the specified semanticstatic <R> List<R>executeList(TypedQuery<R> query, EntityGraph<R> graph) Form ofexecuteList(Query, EntityGraph, String)accepting aTypedQuery.static <R> List<R>executeList(TypedQuery<R> query, EntityGraph<R> graph, String semanticJpaHintName) Form ofexecuteList(Query, EntityGraph, String)accepting aTypedQuery.static <R> List<R>executeList(TypedQuery<R> query, EntityGraph<R> graph, GraphSemantic semantic) Form ofexecuteList(Query, EntityGraph, GraphSemantic)accepting aTypedQuery.static <T> EntityGraph<T>merge(EntityManager em, Class<T> rootType, EntityGraph<T>... graphs) Merges multiple entity graphs into a single graph that specifies the fetching/loading of all attributes the input graphs specify.static <T> EntityGraph<T>merge(SessionImplementor session, Class<T> rootType, GraphImplementor<T>... graphs) static <T> EntityGraph<T>
-
Constructor Details
-
EntityGraphs
public EntityGraphs()
-
-
Method Details
-
merge
public static <T> EntityGraph<T> merge(EntityManager em, Class<T> rootType, EntityGraph<T>... graphs) Merges multiple entity graphs into a single graph that specifies the fetching/loading of all attributes the input graphs specify.- Type Parameters:
T- Root entity type of the query and graph.- Parameters:
em- EntityManager to use to create the new merged graph.rootType- Root type of the entity for which the graph is being merged.graphs- Graphs to merge.- Returns:
- The merged graph.
-
merge
@SafeVarargs public static <T> EntityGraph<T> merge(Session session, Class<T> rootType, Graph<T>... graphs) -
merge
@SafeVarargs public static <T> EntityGraph<T> merge(SessionImplementor session, Class<T> rootType, GraphImplementor<T>... graphs) -
executeList
Convenience method for executing the query, applying the givenEntityGraphusing the specified semantic- Parameters:
query- The JPA Querygraph- The graph to applysemantic- The semantic to use when applying the graph
-
executeList
public static <R> List<R> executeList(TypedQuery<R> query, EntityGraph<R> graph, GraphSemantic semantic) Form ofexecuteList(Query, EntityGraph, GraphSemantic)accepting aTypedQuery.- Parameters:
query- The JPA Querygraph- The graph to applysemantic- The semantic to use when applying the graph
-
executeList
Convenience method for executing the query, applying the givenEntityGraphusing the named semantic using JPA's "hint name". SeeGraphSemantic.fromHintName(java.lang.String).- Parameters:
query- The JPA Querygraph- The graph to applysemanticJpaHintName- SeeGraphSemantic.fromHintName(java.lang.String)- Returns:
- The result list
-
executeList
public static <R> List<R> executeList(TypedQuery<R> query, EntityGraph<R> graph, String semanticJpaHintName) Form ofexecuteList(Query, EntityGraph, String)accepting aTypedQuery.- Parameters:
query- The JPA Querygraph- The graph to applysemanticJpaHintName- SeeGraphSemantic.fromHintName(java.lang.String)
-
executeList
Convenience method for executing the query using the givenEntityGraph.- Parameters:
query- The JPA Querygraph- The graph to apply
-
executeList
Form ofexecuteList(Query, EntityGraph, String)accepting aTypedQuery.- Parameters:
query- The JPA Querygraph- The graph to apply
-
areEqual
Compares two entity graphs and returnstrueif they are equal, ignoring attribute order.- Type Parameters:
T- Root entity type of BOTH graphs.- Parameters:
a- Graph to compare.b- Graph to compare.
-
areEqual
Compares two entity graph attribute node and returnstrueif they are equal, ignoring subgraph attribute order. -
areEqual
Compares two entity subgraph maps and returnstrueif they are equal, ignoring order. -
areEqual
Compares two entity subgraphs and returnstrueif they are equal, ignoring attribute order.
-