Class CriteriaDefinition<R>
- Type Parameters:
R- the query result type
- All Implemented Interfaces:
AbstractQuery<R>,CommonAbstractCriteria,CriteriaBuilder,CriteriaQuery<R>,Serializable,HibernateCriteriaBuilder,JpaCriteriaBase,JpaCriteriaNode,JpaCriteriaQuery<R>,JpaCteContainer,JpaQueryableCriteria<R>,JpaSelectCriteria<R>
CriteriaBuilder and CriteriaQuery may be called without the need for
specifying the target object.
For example:
sessionFactory.inTransaction(session -> {
List<Book> books
= new CriteriaDefinition<>(sessionFactory, Book.class) {{
var book = from(Book.class);
where(like(book.get(Book_.title), "%Hibernate%"));
orderBy(desc(book.get(Book_.publicationDate)), asc(book.get(Book_.isbn)));
book.fetch(Book_.authors);
}}
.createSelectionQuery(session)
.setMaxResults(10)
.getResultList();
...
});
A CriteriaDefinition may even be used to modify a base HQL or criteria query:
sessionFactory.inTransaction(session -> {
List<Book> books
= new CriteriaDefinition<>(sessionFactory, Book.class,
"from Book left join fetch authors where type = BOOK") {{
var book = (JpaRoot<Book>) getSelection();
where(getRestriction(), like(book.get(Book_.title), "%Hibernate%"));
orderBy(desc(book.get(Book_.publicationDate)), asc(book.get(Book_.isbn)));
}}
.createSelectionQuery(session)
.getResultList();
...
});
For queries which don't change between executions, the CriteriaDefinition may be
safely built and cached at startup:
// build and cache the query
static final CriteriaQuery<Book> bookQuery =
new CriteriaDefinition<>(sessionFactory, Book.class) {{
var book = from(Book.class);
where(like(book.get(Book_.title), "%Hibernate%"));
orderBy(desc(book.get(Book_.publicationDate)), asc(book.get(Book_.isbn)));
book.fetch(Book_.authors);
}};
...
// execute it in a session
sessionFactory.inTransaction(session -> {
List<Book> books =
session.createQuery(bookQuery)
.setMaxResults(10)
.getResultList();
...
});
- Since:
- 6.3
- Author:
- Gavin King
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface jakarta.persistence.criteria.CriteriaBuilder
CriteriaBuilder.Case<R>, CriteriaBuilder.Coalesce<T>, CriteriaBuilder.In<T>, CriteriaBuilder.SimpleCase<C,R>, CriteriaBuilder.Trimspec -
Constructor Summary
ConstructorsConstructorDescriptionCriteriaDefinition(EntityManagerFactory factory, CriteriaQuery<R> baseQuery) CriteriaDefinition(EntityManagerFactory factory, Class<R> resultType) CriteriaDefinition(EntityManagerFactory factory, Class<R> resultType, String baseHql) CriteriaDefinition(EntityManager entityManager, CriteriaQuery<R> baseQuery) CriteriaDefinition(EntityManager entityManager, Class<R> resultType) CriteriaDefinition(EntityManager entityManager, Class<R> resultType, String baseHql) CriteriaDefinition(SessionFactory factory, CriteriaQuery<R> baseQuery) CriteriaDefinition(SessionFactory factory, Class<R> resultType) CriteriaDefinition(SessionFactory factory, Class<R> resultType, String baseHql) CriteriaDefinition(SharedSessionContract session, CriteriaQuery<R> baseQuery) CriteriaDefinition(SharedSessionContract session, Class<R> resultType) CriteriaDefinition(SharedSessionContract session, Class<R> resultType, String baseHql) -
Method Summary
Modifier and TypeMethodDescriptionA query that returns the number of results of this query.createQuery(EntityManager entityManager) createSelectionQuery(QueryProducer session) distinct(boolean distinct) Specify whether duplicate query results will be eliminated.fetch(Number fetch, FetchClauseType fetchClauseType) fetch(JpaExpression<? extends Number> fetch) fetch(JpaExpression<? extends Number> fetch, FetchClauseType fetchClauseType) <X> JpaDerivedRoot<X>Create and add a query root corresponding to the given subquery, forming a cartesian product with any existing roots.<X> JpaRoot<X>from(EntityType<X> entity) Create and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.<X> JpaRoot<X>Create and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.<X> JpaRoot<X>from(JpaCteCriteria<X> cte) Create and add a query root corresponding to the given cte, forming a cartesian product with any existing roots.<T> JpaCteCriteria<T>getCteCriteria(String cteName) Returns a CTE that is registered by the given name on this container, or any of its parents.Collection<? extends JpaCteCriteria<?>>Returns the CTEs that are registered on this container.getFetch()List<Expression<?>>Return a list of the grouping expressions.Return the predicate that corresponds to the restriction(s) over the grouping items, or null if no restrictions have been specified.Return the ordering expressions in order of precedence.Return the parameters of the query.The query structure.The query structure.Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.Return the result type of the query or subquery.Return the roots as a list.getRoots()Return the query roots.Return the selection of the query, or null if no selection has been set.groupBy(Expression... grouping) Specify the expressions that are used to form groups over the query results.groupBy(List<Expression<?>> grouping) Specify the expressions that are used to form groups over the query results.having(Expression<Boolean> restriction) Specify a restriction over the groups of the query.Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates.booleanReturn whether duplicate query results must be eliminated or retained.multiselect(Selection<?>... selections) Specify the selection items that are to be returned in the query result.multiselect(List<Selection<?>> list) Specify the selection items that are to be returned in the query result.offset(JpaExpression<? extends Number> offset) Specify the ordering expressions that are used to order the query results.Specify the ordering expressions that are used to order the query results.Specify the item that is to be returned in the query result.<U> JpaSubQuery<U>Create a subquery of the query.where(Expression<Boolean> restriction) Modify the query to restrict the query result according to the specified boolean expression.Modify the query to restrict the query result according to the conjunction of the specified restriction predicates.<T> JpaCteCriteria<T>with(AbstractQuery<T> criteria) Registers the givenCriteriaQueryand returns aJpaCteCriteria, which can be used for querying.<T> JpaCteCriteria<T>with(String name, AbstractQuery<T> criteria) LikeJpaCteContainer.with(AbstractQuery)but assigns an explicit CTE name.<T> JpaCteCriteria<T>withRecursiveUnionAll(AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) Allows to register a recursive CTE.<T> JpaCteCriteria<T>withRecursiveUnionAll(String name, AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) LikeJpaCteContainer.withRecursiveUnionAll(AbstractQuery, Function)but assigns an explicit CTE name.<T> JpaCteCriteria<T>withRecursiveUnionDistinct(AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) Allows to register a recursive CTE.<T> JpaCteCriteria<T>withRecursiveUnionDistinct(String name, AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) LikeJpaCteContainer.withRecursiveUnionDistinct(AbstractQuery, Function)but assigns an explicit CTE name.Methods inherited from class org.hibernate.query.criteria.spi.HibernateCriteriaBuilderDelegate
abs, acos, addDuration, addDuration, addDuration, all, and, and, any, array, array, array, array, arrayAgg, arrayAgg, arrayAgg, arrayAgg, arrayAppend, arrayAppend, arrayConcat, arrayConcat, arrayConcat, arrayContains, arrayContains, arrayContains, arrayContainsAll, arrayContainsAll, arrayContainsAll, arrayContainsAllNullable, arrayContainsAllNullable, arrayContainsAllNullable, arrayContainsNullable, arrayContainsNullable, arrayContainsNullable, arrayFill, arrayFill, arrayFill, arrayFill, arrayGet, arrayGet, arrayIncludes, arrayIncludes, arrayIncludes, arrayIncludesNullable, arrayIncludesNullable, arrayIncludesNullable, arrayIntersects, arrayIntersects, arrayIntersects, arrayIntersectsNullable, arrayIntersectsNullable, arrayIntersectsNullable, arrayLength, arrayLiteral, arrayOverlaps, arrayOverlaps, arrayOverlaps, arrayOverlapsNullable, arrayOverlapsNullable, arrayOverlapsNullable, arrayPosition, arrayPosition, arrayPositions, arrayPositions, arrayPositionsList, arrayPositionsList, arrayPrepend, arrayPrepend, arrayRemove, arrayRemove, arrayRemoveIndex, arrayRemoveIndex, arrayReplace, arrayReplace, arrayReplace, arrayReplace, arraySet, arraySet, arraySet, arraySet, arraySlice, arraySlice, arraySlice, arraySlice, arrayToString, arrayToString, arrayTrim, arrayTrim, asc, asc, asc, asc, asin, atan, atan2, atan2, atan2, avg, avg, avg, avg, between, between, cast, ceiling, coalesce, coalesce, coalesce, collate, collectionAppend, collectionAppend, collectionConcat, collectionConcat, collectionConcat, collectionContains, collectionContains, collectionContains, collectionContainsAll, collectionContainsAll, collectionContainsAll, collectionContainsAllNullable, collectionContainsAllNullable, collectionContainsAllNullable, collectionContainsNullable, collectionContainsNullable, collectionContainsNullable, collectionFill, collectionFill, collectionFill, collectionFill, collectionGet, collectionGet, collectionIncludes, collectionIncludes, collectionIncludes, collectionIncludesNullable, collectionIncludesNullable, collectionIncludesNullable, collectionIntersects, collectionIntersects, collectionIntersects, collectionIntersectsNullable, collectionIntersectsNullable, collectionIntersectsNullable, collectionLength, collectionLiteral, collectionOverlaps, collectionOverlaps, collectionOverlaps, collectionOverlapsNullable, collectionOverlapsNullable, collectionOverlapsNullable, collectionPosition, collectionPosition, collectionPositions, collectionPositions, collectionPositionsList, collectionPositionsList, collectionPrepend, collectionPrepend, collectionRemove, collectionRemove, collectionRemoveIndex, collectionRemoveIndex, collectionReplace, collectionReplace, collectionReplace, collectionReplace, collectionSet, collectionSet, collectionSet, collectionSet, collectionSlice, collectionSlice, collectionSlice, collectionSlice, collectionToString, collectionToString, collectionTrim, collectionTrim, concat, concat, concat, concat, conjunction, construct, construct, cos, cosh, count, count, count, count, count, countDistinct, createCriteriaDelete, createCriteriaInsertSelect, createCriteriaInsertValues, createCriteriaUpdate, createQuery, createQuery, createQuery, createTupleQuery, createWindow, cumeDist, currentDate, currentInstant, currentTime, currentTimestamp, day, degrees, denseRank, desc, desc, desc, desc, diff, diff, diff, disjunction, distinctFrom, distinctFrom, duration, durationBetween, durationBetween, durationByUnit, durationDiff, durationDiff, durationScaled, durationScaled, durationScaled, durationSum, durationSum, equal, equal, except, except, except, except, exceptAll, exceptAll, exists, exp, firstValue, fk, floor, format, frameBetweenFollowing, frameBetweenFollowing, frameBetweenPreceding, frameBetweenPreceding, frameCurrentRow, frameUnboundedFollowing, frameUnboundedPreceding, function, functionAggregate, functionAggregate, functionAggregate, functionWithinGroup, functionWithinGroup, functionWithinGroup, functionWithinGroup, ge, ge, getCriteriaBuilder, greaterThan, greaterThan, greaterThanOrEqualTo, greaterThanOrEqualTo, greatest, gt, gt, hour, ilike, ilike, ilike, ilike, ilike, ilike, in, in, in, in, indexes, intersect, intersect, intersect, intersect, intersectAll, intersectAll, isEmpty, isFalse, isMapEmpty, isMapNotEmpty, isMember, isMember, isNotEmpty, isNotMember, isNotMember, isNotNull, isNull, isTrue, keys, lastValue, le, le, least, left, left, length, lessThan, lessThan, lessThanOrEqualTo, lessThanOrEqualTo, like, like, like, like, like, like, listagg, listagg, listagg, listagg, listagg, listagg, listagg, listagg, literal, literals, literals, ln, localDate, localDateTime, localTime, locate, locate, locate, locate, log, log, log10, lower, lt, lt, mapSize, mapSize, max, min, minute, mod, mod, mod, mode, mode, mode, mode, month, neg, not, notDistinctFrom, notDistinctFrom, notEqual, notEqual, notIlike, notIlike, notIlike, notIlike, notIlike, notIlike, notLike, notLike, notLike, notLike, notLike, notLike, nthValue, nthValue, nullif, nullif, nullLiteral, or, or, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, overlay, pad, pad, pad, pad, pad, pad, pad, pad, pad, pad, pad, pad, parameter, parameter, percentileCont, percentileCont, percentileCont, percentileCont, percentileDisc, percentileDisc, percentileDisc, percentileDisc, percentRank, percentRank, percentRank, percentRank, percentRank, pi, power, power, prod, prod, prod, quot, quot, quot, radians, rank, rank, rank, rank, rank, repeat, repeat, repeat, replace, replace, replace, replace, right, right, round, rowNumber, search, search, search, second, selectCase, selectCase, sign, sin, sinh, size, size, some, sort, sort, sort, sort, sql, sqrt, substring, substring, substring, substring, subtractDuration, subtractDuration, subtractDuration, sum, sum, sum, sum, sum, sum, sum, sumAsDouble, sumAsLong, tan, tanh, toBigDecimal, toBigInteger, toDouble, toFloat, toInteger, toLong, toString, treat, treat, treat, treat, treat, treat, treat, trim, trim, trim, trim, trim, trim, truncate, truncate, tuple, tuple, union, union, union, union, unionAll, unionAll, unwrap, upper, value, values, values, values, windowFunction, wrap, wrap, year
-
Constructor Details
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
-
Method Details
-
createSelectionQuery
-
createQuery
-
restrict
-
select
Description copied from interface:CriteriaQuerySpecify the item that is to be returned in the query result. Replaces the previously specified selection(s), if any.Note: Applications using the string-based API may need to specify the type of the select item when it results from a get or join operation and the query result type is specified.
For example: CriteriaQuery<String> q = cb.createQuery(String.class); Root<Order> order = q.from(Order.class); q.select(order.get("shippingAddress").<String>get("state")); CriteriaQuery<Product> q2 = cb.createQuery(Product.class); q2.select(q2.from(Order.class) .join("items") .<Item,Product>join("product"));- Specified by:
selectin interfaceCriteriaQuery<R>- Specified by:
selectin interfaceJpaCriteriaQuery<R>- Parameters:
selection- selection specifying the item that is to be returned in the query result- Returns:
- the modified query
-
multiselect
Description copied from interface:CriteriaQuerySpecify the selection items that are to be returned in the query result. Replaces the previously specified selection(s), if any. The type of the result of the query execution depends on the specification of the type of the criteria query object created as well as the arguments to the multiselect method.An argument to the multiselect method must not be a tuple- or array-valued compound selection item.
The semantics of this method are as follows:
-
If the type of the criteria query is
CriteriaQuery<Tuple>(i.e., a criteria query object created by either thecreateTupleQuerymethod or by passing aTupleclass argument to thecreateQuerymethod), aTupleobject corresponding to the arguments of themultiselectmethod, in the specified order, will be instantiated and returned for each row that results from the query execution. - If the type of the criteria query is
CriteriaQuery<X>for some user-defined class X (i.e., a criteria query object created by passing a X class argument to thecreateQuerymethod), the arguments to themultiselectmethod will be passed to the X constructor and an instance of type X will be returned for each row. - If the type of the criteria query is
CriteriaQuery<X[]>for some class X, an instance of type X[] will be returned for each row. The elements of the array will correspond to the arguments of themultiselectmethod, in the specified order. - If the type of the criteria query is
CriteriaQuery<Object>or if the criteria query was created without specifying a type, and only a single argument is passed to themultiselectmethod, an instance of typeObjectwill be returned for each row. - If the type of the criteria query is
CriteriaQuery<Object>or if the criteria query was created without specifying a type, and more than one argument is passed to themultiselectmethod, an instance of typeObject[]will be instantiated and returned for each row. The elements of the array will correspond to the arguments to themultiselectmethod, in the specified order.
- Specified by:
multiselectin interfaceCriteriaQuery<R>- Specified by:
multiselectin interfaceJpaCriteriaQuery<R>- Parameters:
selections- selection items corresponding to the results to be returned by the query- Returns:
- the modified query
-
If the type of the criteria query is
-
multiselect
Description copied from interface:CriteriaQuerySpecify the selection items that are to be returned in the query result. Replaces the previously specified selection(s), if any.The type of the result of the query execution depends on the specification of the type of the criteria query object created as well as the argument to the
multiselectmethod. An element of the list passed to themultiselectmethod must not be a tuple- or array-valued compound selection item.The semantics of this method are as follows:
- If the type of the criteria query is
CriteriaQuery<Tuple>(i.e., a criteria query object created by either thecreateTupleQuerymethod or by passing aTupleclass argument to thecreateQuerymethod), aTupleobject corresponding to the elements of the list passed to themultiselectmethod, in the specified order, will be instantiated and returned for each row that results from the query execution. - If the type of the criteria query is
CriteriaQuery<X>for some user-defined class X (i.e., a criteria query object created by passing a X class argument to thecreateQuerymethod), the elements of the list passed to themultiselectmethod will be passed to the X constructor and an instance of type X will be returned for each row. - If the type of the criteria query is
CriteriaQuery<X[]>for some class X, an instance of type X[] will be returned for each row. The elements of the array will correspond to the elements of the list passed to themultiselectmethod, in the specified order. - If the type of the criteria query is
CriteriaQuery<Object>or if the criteria query was created without specifying a type, and the list passed to themultiselectmethod contains only a single element, an instance of typeObjectwill be returned for each row. - If the type of the criteria query is
CriteriaQuery<Object>or if the criteria query was created without specifying a type, and the list passed to themultiselectmethod contains more than one element, an instance of typeObject[]will be instantiated and returned for each row. The elements of the array will correspond to the elements of the list passed to themultiselectmethod, in the specified order.
- Specified by:
multiselectin interfaceCriteriaQuery<R>- Specified by:
multiselectin interfaceJpaCriteriaQuery<R>- Parameters:
list- list of selection items corresponding to the results to be returned by the query- Returns:
- the modified query
- If the type of the criteria query is
-
where
Description copied from interface:CriteriaQueryModify the query to restrict the query result according to the specified boolean expression. Replaces the previously added restriction(s), if any. This method only overrides the return type of the correspondingAbstractQuerymethod.- Specified by:
wherein interfaceAbstractQuery<R>- Specified by:
wherein interfaceCriteriaQuery<R>- Specified by:
wherein interfaceJpaCriteriaQuery<R>- Specified by:
wherein interfaceJpaSelectCriteria<R>- Parameters:
restriction- a simple or compound boolean expression- Returns:
- the modified query
-
where
Description copied from interface:CriteriaQueryModify the query to restrict the query result according to the conjunction of the specified restriction predicates. Replaces the previously added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed. This method only overrides the return type of the correspondingAbstractQuerymethod.- Specified by:
wherein interfaceAbstractQuery<R>- Specified by:
wherein interfaceCriteriaQuery<R>- Specified by:
wherein interfaceJpaCriteriaQuery<R>- Specified by:
wherein interfaceJpaSelectCriteria<R>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-
groupBy
Description copied from interface:CriteriaQuerySpecify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return type of the correspondingAbstractQuerymethod.- Specified by:
groupByin interfaceAbstractQuery<R>- Specified by:
groupByin interfaceCriteriaQuery<R>- Specified by:
groupByin interfaceJpaCriteriaQuery<R>- Specified by:
groupByin interfaceJpaSelectCriteria<R>- Parameters:
grouping- zero or more grouping expressions- Returns:
- the modified query
-
groupBy
Description copied from interface:CriteriaQuerySpecify the expressions that are used to form groups over the query results. Replaces the previous specified grouping expressions, if any. If no grouping expressions are specified, any previously added grouping expressions are simply removed. This method only overrides the return type of the correspondingAbstractQuerymethod.- Specified by:
groupByin interfaceAbstractQuery<R>- Specified by:
groupByin interfaceCriteriaQuery<R>- Specified by:
groupByin interfaceJpaCriteriaQuery<R>- Specified by:
groupByin interfaceJpaSelectCriteria<R>- Parameters:
grouping- list of zero or more grouping expressions- Returns:
- the modified query
-
having
Description copied from interface:CriteriaQuerySpecify a restriction over the groups of the query. Replaces the previous having restriction(s), if any. This method only overrides the return type of the correspondingAbstractQuerymethod.- Specified by:
havingin interfaceAbstractQuery<R>- Specified by:
havingin interfaceCriteriaQuery<R>- Specified by:
havingin interfaceJpaCriteriaQuery<R>- Specified by:
havingin interfaceJpaSelectCriteria<R>- Parameters:
restriction- a simple or compound boolean expression- Returns:
- the modified query
-
having
Description copied from interface:CriteriaQuerySpecify restrictions over the groups of the query according the conjunction of the specified restriction predicates. Replaces the previously added having restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed. This method only overrides the return type of the correspondingAbstractQuerymethod.- Specified by:
havingin interfaceAbstractQuery<R>- Specified by:
havingin interfaceCriteriaQuery<R>- Specified by:
havingin interfaceJpaCriteriaQuery<R>- Specified by:
havingin interfaceJpaSelectCriteria<R>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-
orderBy
Description copied from interface:CriteriaQuerySpecify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The left-to-right sequence of the ordering expressions determines the precedence, whereby the leftmost has highest precedence.- Specified by:
orderByin interfaceCriteriaQuery<R>- Specified by:
orderByin interfaceJpaCriteriaQuery<R>- Parameters:
o- zero or more ordering expressions- Returns:
- the modified query
-
orderBy
Description copied from interface:CriteriaQuerySpecify the ordering expressions that are used to order the query results. Replaces the previous ordering expressions, if any. If no ordering expressions are specified, the previous ordering, if any, is simply removed, and results will be returned in no particular order. The order of the ordering expressions in the list determines the precedence, whereby the first element in the list has highest precedence.- Specified by:
orderByin interfaceCriteriaQuery<R>- Specified by:
orderByin interfaceJpaCriteriaQuery<R>- Parameters:
o- list of zero or more ordering expressions- Returns:
- the modified query
-
distinct
Description copied from interface:CriteriaQuerySpecify whether duplicate query results will be eliminated. A true value will cause duplicates to be eliminated. A false value will cause duplicates to be retained. If distinct has not been specified, duplicate results must be retained. This method only overrides the return type of the correspondingAbstractQuerymethod.- Specified by:
distinctin interfaceAbstractQuery<R>- Specified by:
distinctin interfaceCriteriaQuery<R>- Specified by:
distinctin interfaceJpaCriteriaQuery<R>- Specified by:
distinctin interfaceJpaSelectCriteria<R>- Parameters:
distinct- boolean value specifying whether duplicate results must be eliminated from the query result or whether they must be retained- Returns:
- the modified query.
-
getOrderList
Description copied from interface:CriteriaQueryReturn the ordering expressions in order of precedence. Returns empty list if no ordering expressions have been specified. Modifications to the list do not affect the query.- Specified by:
getOrderListin interfaceCriteriaQuery<R>- Specified by:
getOrderListin interfaceJpaCriteriaQuery<R>- Returns:
- the list of ordering expressions
-
getParameters
Description copied from interface:JpaCriteriaQueryReturn the parameters of the query. Returns empty set if there are no parameters. Modifications to the set do not affect the query.- Specified by:
getParametersin interfaceCriteriaQuery<R>- Specified by:
getParametersin interfaceJpaCriteriaQuery<R>- Returns:
- the query parameters
-
from
Description copied from interface:AbstractQueryCreate and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceAbstractQuery<R>- Specified by:
fromin interfaceJpaCriteriaQuery<R>- Specified by:
fromin interfaceJpaSelectCriteria<R>- Parameters:
entityClass- the entity class- Returns:
- query root corresponding to the given entity
-
from
Description copied from interface:AbstractQueryCreate and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceAbstractQuery<R>- Specified by:
fromin interfaceJpaCriteriaQuery<R>- Specified by:
fromin interfaceJpaSelectCriteria<R>- Parameters:
entity- metamodel entity representing the entity of type X- Returns:
- query root corresponding to the given entity
-
subquery
Description copied from interface:CommonAbstractCriteriaCreate a subquery of the query.- Specified by:
subqueryin interfaceCommonAbstractCriteria- Specified by:
subqueryin interfaceJpaCriteriaBase- Parameters:
type- the subquery result type- Returns:
- subquery
-
getRoots
Description copied from interface:AbstractQueryReturn the query roots. These are the roots that have been defined for theCriteriaQueryorSubqueryitself, including any subquery roots defined as a result of correlation. Returns empty set if no roots have been defined. Modifications to the set do not affect the query.- Specified by:
getRootsin interfaceAbstractQuery<R>- Returns:
- the set of query roots
-
getSelection
Description copied from interface:AbstractQueryReturn the selection of the query, or null if no selection has been set.- Specified by:
getSelectionin interfaceAbstractQuery<R>- Specified by:
getSelectionin interfaceJpaSelectCriteria<R>- Returns:
- selection item
-
getGroupList
Description copied from interface:AbstractQueryReturn a list of the grouping expressions. Returns empty list if no grouping expressions have been specified. Modifications to the list do not affect the query.- Specified by:
getGroupListin interfaceAbstractQuery<R>- Returns:
- the list of grouping expressions
-
getGroupRestriction
Description copied from interface:AbstractQueryReturn the predicate that corresponds to the restriction(s) over the grouping items, or null if no restrictions have been specified.- Specified by:
getGroupRestrictionin interfaceAbstractQuery<R>- Specified by:
getGroupRestrictionin interfaceJpaSelectCriteria<R>- Returns:
- having clause predicate
-
isDistinct
public boolean isDistinct()Description copied from interface:AbstractQueryReturn whether duplicate query results must be eliminated or retained.- Specified by:
isDistinctin interfaceAbstractQuery<R>- Returns:
- boolean indicating whether duplicate query results must be eliminated
-
getResultType
Description copied from interface:AbstractQueryReturn the result type of the query or subquery. If a result type was specified as an argument to thecreateQueryorsubquerymethod, that type will be returned. If the query was created using thecreateTupleQuerymethod, the result type isTuple. Otherwise, the result type isObject.- Specified by:
getResultTypein interfaceAbstractQuery<R>- Returns:
- result type
-
getRestriction
Description copied from interface:CommonAbstractCriteriaReturn the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.- Specified by:
getRestrictionin interfaceCommonAbstractCriteria- Specified by:
getRestrictionin interfaceJpaCriteriaBase- Specified by:
getRestrictionin interfaceJpaSelectCriteria<R>- Returns:
- where clause predicate
-
getOffset
- Specified by:
getOffsetin interfaceJpaCriteriaQuery<R>
-
offset
- Specified by:
offsetin interfaceJpaCriteriaQuery<R>
-
offset
- Specified by:
offsetin interfaceJpaCriteriaQuery<R>
-
getFetch
- Specified by:
getFetchin interfaceJpaCriteriaQuery<R>
-
fetch
- Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
fetch
public JpaCriteriaQuery<R> fetch(JpaExpression<? extends Number> fetch, FetchClauseType fetchClauseType) - Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
fetch
- Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
fetch
- Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
getFetchClauseType
- Specified by:
getFetchClauseTypein interfaceJpaCriteriaQuery<R>
-
getRootList
Description copied from interface:JpaCriteriaQueryReturn the roots as a list.- Specified by:
getRootListin interfaceJpaCriteriaQuery<R>
-
getCteCriterias
Description copied from interface:JpaCteContainerReturns the CTEs that are registered on this container.- Specified by:
getCteCriteriasin interfaceJpaCteContainer
-
getCteCriteria
Description copied from interface:JpaCteContainerReturns a CTE that is registered by the given name on this container, or any of its parents.- Specified by:
getCteCriteriain interfaceJpaCteContainer
-
with
Description copied from interface:JpaCteContainerRegisters the givenCriteriaQueryand returns aJpaCteCriteria, which can be used for querying.- Specified by:
within interfaceJpaCteContainer- See Also:
-
withRecursiveUnionAll
public <T> JpaCteCriteria<T> withRecursiveUnionAll(AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerAllows to register a recursive CTE. The baseCriteriaQueryserves for the structure of theJpaCteCriteria, which is made available in the recursive criteria producer function, so that the recursiveCriteriaQueryis able to refer to the CTE again.- Specified by:
withRecursiveUnionAllin interfaceJpaCteContainer- See Also:
-
withRecursiveUnionDistinct
public <T> JpaCteCriteria<T> withRecursiveUnionDistinct(AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerAllows to register a recursive CTE. The baseCriteriaQueryserves for the structure of theJpaCteCriteria, which is made available in the recursive criteria producer function, so that the recursiveCriteriaQueryis able to refer to the CTE again.- Specified by:
withRecursiveUnionDistinctin interfaceJpaCteContainer- See Also:
-
with
Description copied from interface:JpaCteContainerLikeJpaCteContainer.with(AbstractQuery)but assigns an explicit CTE name.- Specified by:
within interfaceJpaCteContainer
-
withRecursiveUnionAll
public <T> JpaCteCriteria<T> withRecursiveUnionAll(String name, AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerLikeJpaCteContainer.withRecursiveUnionAll(AbstractQuery, Function)but assigns an explicit CTE name.- Specified by:
withRecursiveUnionAllin interfaceJpaCteContainer
-
withRecursiveUnionDistinct
public <T> JpaCteCriteria<T> withRecursiveUnionDistinct(String name, AbstractQuery<T> baseCriteria, Function<JpaCteCriteria<T>, AbstractQuery<T>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerLikeJpaCteContainer.withRecursiveUnionDistinct(AbstractQuery, Function)but assigns an explicit CTE name.- Specified by:
withRecursiveUnionDistinctin interfaceJpaCteContainer
-
getQuerySpec
Description copied from interface:JpaSelectCriteriaThe query structure. SeeJpaQueryStructurefor details- Specified by:
getQuerySpecin interfaceJpaSelectCriteria<R>
-
getQueryPart
Description copied from interface:JpaSelectCriteriaThe query structure. SeeJpaQueryStructurefor details- Specified by:
getQueryPartin interfaceJpaSelectCriteria<R>
-
from
Description copied from interface:JpaSelectCriteriaCreate and add a query root corresponding to the given subquery, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceJpaSelectCriteria<R>- Parameters:
subquery- the subquery- Returns:
- query root corresponding to the given subquery
-
from
Description copied from interface:JpaSelectCriteriaCreate and add a query root corresponding to the given cte, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceJpaSelectCriteria<R>- Parameters:
cte- the cte criteria- Returns:
- query root corresponding to the given cte
-
createCountQuery
Description copied from interface:JpaCriteriaQueryA query that returns the number of results of this query.- Specified by:
createCountQueryin interfaceJpaCriteriaQuery<R>- See Also:
-