public final class EntityGraphs
extends java.lang.Object
EntityGraph
utilities.
These methods really belong inside other classes that we cannot modify, hence here.Constructor and Description |
---|
EntityGraphs() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areEqual(javax.persistence.AttributeNode<?> a,
javax.persistence.AttributeNode<?> b)
Compares two entity graph attribute node and returns
true if they are equal, ignoring subgraph attribute
order. |
static <T> boolean |
areEqual(javax.persistence.EntityGraph<T> a,
javax.persistence.EntityGraph<T> b)
Compares two entity graphs and returns
true if they are equal, ignoring attribute order. |
static boolean |
areEqual(java.util.Map<java.lang.Class,javax.persistence.Subgraph> a,
java.util.Map<java.lang.Class,javax.persistence.Subgraph> b)
Compares two entity subgraph maps and returns
true if they are equal, ignoring order. |
static boolean |
areEqual(javax.persistence.Subgraph a,
javax.persistence.Subgraph b)
Compares two entity subgraphs and returns
true if they are equal, ignoring attribute order. |
static java.util.List |
executeList(javax.persistence.Query query,
javax.persistence.EntityGraph graph)
Convenience method for executing the Query using the
given EntityGraph
|
static java.util.List |
executeList(javax.persistence.Query query,
javax.persistence.EntityGraph graph,
GraphSemantic semantic)
Convenience method for executing the Query, applying the
given EntityGraph using the specified semantic
|
static java.util.List |
executeList(javax.persistence.Query query,
javax.persistence.EntityGraph graph,
java.lang.String semanticJpaHintName)
Convenience method for executing the Query, applying the
given EntityGraph using the named semantic using JPA's "hint name" - see
GraphSemantic.fromJpaHintName(java.lang.String) |
static <R> java.util.List<R> |
executeList(javax.persistence.TypedQuery<R> query,
javax.persistence.EntityGraph<R> graph)
Form of
executeList(Query, EntityGraph, String) accepting a TypedQuery |
static <R> java.util.List<R> |
executeList(javax.persistence.TypedQuery<R> query,
javax.persistence.EntityGraph<R> graph,
GraphSemantic semantic)
Form of
executeList(Query, EntityGraph, GraphSemantic) accepting a TypedQuery. |
static <R> java.util.List<R> |
executeList(javax.persistence.TypedQuery<R> query,
javax.persistence.EntityGraph<R> graph,
java.lang.String semanticJpaHintName)
Form of
executeList(Query, EntityGraph, String) accepting a TypedQuery |
static <T> javax.persistence.EntityGraph<T> |
merge(javax.persistence.EntityManager em,
java.lang.Class<T> rootType,
javax.persistence.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> javax.persistence.EntityGraph<T> |
merge(Session session,
java.lang.Class<T> rootType,
Graph<T>... graphs) |
static <T> javax.persistence.EntityGraph<T> |
merge(SessionImplementor session,
java.lang.Class<T> rootType,
GraphImplementor<T>... graphs) |
public static <T> javax.persistence.EntityGraph<T> merge(javax.persistence.EntityManager em, java.lang.Class<T> rootType, javax.persistence.EntityGraph<T>... graphs)
T
- Root entity type of the query and graph.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.@SafeVarargs public static <T> javax.persistence.EntityGraph<T> merge(Session session, java.lang.Class<T> rootType, Graph<T>... graphs)
@SafeVarargs public static <T> javax.persistence.EntityGraph<T> merge(SessionImplementor session, java.lang.Class<T> rootType, GraphImplementor<T>... graphs)
public static java.util.List executeList(javax.persistence.Query query, javax.persistence.EntityGraph graph, GraphSemantic semantic)
query
- The JPA Querygraph
- The graph to applysemantic
- The semantic to use when applying the graphpublic static <R> java.util.List<R> executeList(javax.persistence.TypedQuery<R> query, javax.persistence.EntityGraph<R> graph, GraphSemantic semantic)
executeList(Query, EntityGraph, GraphSemantic)
accepting a TypedQuery.query
- The JPA Querygraph
- The graph to applysemantic
- The semantic to use when applying the graphpublic static java.util.List executeList(javax.persistence.Query query, javax.persistence.EntityGraph graph, java.lang.String semanticJpaHintName)
GraphSemantic.fromJpaHintName(java.lang.String)
query
- The JPA Querygraph
- The graph to applysemanticJpaHintName
- See GraphSemantic.fromJpaHintName(java.lang.String)
public static <R> java.util.List<R> executeList(javax.persistence.TypedQuery<R> query, javax.persistence.EntityGraph<R> graph, java.lang.String semanticJpaHintName)
executeList(Query, EntityGraph, String)
accepting a TypedQueryquery
- The JPA Querygraph
- The graph to applysemanticJpaHintName
- See GraphSemantic.fromJpaHintName(java.lang.String)
public static java.util.List executeList(javax.persistence.Query query, javax.persistence.EntityGraph graph)
query
- The JPA Querygraph
- The graph to applyGraphSemantic.FETCH
. This is simply
knowledge from JPA EG discussions, nothing that is specifically mentioned or
discussed in the spec.public static <R> java.util.List<R> executeList(javax.persistence.TypedQuery<R> query, javax.persistence.EntityGraph<R> graph)
executeList(Query, EntityGraph, String)
accepting a TypedQueryquery
- The JPA Querygraph
- The graph to applypublic static <T> boolean areEqual(javax.persistence.EntityGraph<T> a, javax.persistence.EntityGraph<T> b)
true
if they are equal, ignoring attribute order.T
- Root entity type of BOTH graphs.a
- Graph to compare.b
- Graph to compare.public static boolean areEqual(javax.persistence.AttributeNode<?> a, javax.persistence.AttributeNode<?> b)
true
if they are equal, ignoring subgraph attribute
order.public static boolean areEqual(java.util.Map<java.lang.Class,javax.persistence.Subgraph> a, java.util.Map<java.lang.Class,javax.persistence.Subgraph> b)
true
if they are equal, ignoring order.public static boolean areEqual(javax.persistence.Subgraph a, javax.persistence.Subgraph b)
true
if they are equal, ignoring attribute order.Copyright © 2001-2020 Red Hat, Inc. All Rights Reserved.