public final class EntityGraphs extends 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(AttributeNode<?> a,
AttributeNode<?> b)
Compares two entity graph attribute node and returns
true if they are equal, ignoring subgraph attribute
order. |
static <T> boolean |
areEqual(EntityGraph<T> a,
EntityGraph<T> b)
Compares two entity graphs and returns
true if they are equal, ignoring attribute order. |
static boolean |
areEqual(Map<Class,Subgraph> a,
Map<Class,Subgraph> b)
Compares two entity subgraph maps and returns
true if they are equal, ignoring order. |
static boolean |
areEqual(Subgraph a,
Subgraph b)
Compares two entity subgraphs and returns
true if they are equal, ignoring attribute order. |
static List |
executeList(Query query,
EntityGraph graph)
Convenience method for executing the Query using the
given EntityGraph
|
static List |
executeList(Query query,
EntityGraph graph,
GraphSemantic semantic)
Convenience method for executing the Query, applying the
given EntityGraph using the specified semantic
|
static List |
executeList(Query query,
EntityGraph graph,
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> List<R> |
executeList(TypedQuery<R> query,
EntityGraph<R> graph)
Form of
executeList(Query, EntityGraph, String) accepting a TypedQuery |
static <R> List<R> |
executeList(TypedQuery<R> query,
EntityGraph<R> graph,
GraphSemantic semantic)
Form of
executeList(Query, EntityGraph, GraphSemantic) accepting a TypedQuery. |
static <R> List<R> |
executeList(TypedQuery<R> query,
EntityGraph<R> graph,
String semanticJpaHintName)
Form of
executeList(Query, EntityGraph, String) accepting a TypedQuery |
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(Session session,
Class<T> rootType,
Graph<T>... graphs) |
static <T> EntityGraph<T> |
merge(SessionImplementor session,
Class<T> rootType,
GraphImplementor<T>... graphs) |
public static <T> EntityGraph<T> merge(EntityManager em, Class<T> rootType, 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> EntityGraph<T> merge(Session session, Class<T> rootType, Graph<T>... graphs)
@SafeVarargs public static <T> EntityGraph<T> merge(SessionImplementor session, Class<T> rootType, GraphImplementor<T>... graphs)
public static List executeList(Query query, EntityGraph graph, GraphSemantic semantic)
query
- The JPA Querygraph
- The graph to applysemantic
- The semantic to use when applying the graphpublic static <R> List<R> executeList(TypedQuery<R> query, 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 List executeList(Query query, EntityGraph graph, String semanticJpaHintName)
GraphSemantic.fromJpaHintName(java.lang.String)
query
- The JPA Querygraph
- The graph to applysemanticJpaHintName
- See GraphSemantic.fromJpaHintName(java.lang.String)
public static <R> List<R> executeList(TypedQuery<R> query, EntityGraph<R> graph, String semanticJpaHintName)
executeList(Query, EntityGraph, String)
accepting a TypedQueryquery
- The JPA Querygraph
- The graph to applysemanticJpaHintName
- See GraphSemantic.fromJpaHintName(java.lang.String)
public static List executeList(Query query, EntityGraph graph)
query
- The JPA Querygraph
- The graph to applypublic static <R> List<R> executeList(TypedQuery<R> query, EntityGraph<R> graph)
executeList(Query, EntityGraph, String)
accepting a TypedQueryquery
- The JPA Querygraph
- The graph to applypublic static <T> boolean areEqual(EntityGraph<T> a, 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(AttributeNode<?> a, AttributeNode<?> b)
true
if they are equal, ignoring subgraph attribute
order.public static boolean areEqual(Map<Class,Subgraph> a, Map<Class,Subgraph> b)
true
if they are equal, ignoring order.Copyright © 2001-2021 Red Hat, Inc. All Rights Reserved.