Class CriteriaDefinition<R>
java.lang.Object
org.hibernate.query.criteria.spi.HibernateCriteriaBuilderDelegate
org.hibernate.query.criteria.CriteriaDefinition<R>
- Type Parameters:
R- the query result type
- All Implemented Interfaces:
AbstractQuery<R>, CommonAbstractCriteria, CriteriaBuilder, CriteriaQuery<R>, CriteriaSelect<R>, Serializable, HibernateCriteriaBuilder, JpaCriteriaBase, JpaCriteriaNode, JpaCriteriaQuery<R>, JpaCriteriaSelect<R>, JpaCteContainer, JpaQueryableCriteria<R>, JpaSelectCriteria<R>
@Incubating(since="6.3")
public abstract class CriteriaDefinition<R>
extends HibernateCriteriaBuilderDelegate
implements JpaCriteriaQuery<R>
A utility class that makes it easier to build criteria queries.
From within an initializer block of a (usually anonymous) subclass, all operations of the
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 = getRoot(0, Book.class);
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();
...
});
A CriteriaDefinition may be used to modify another CriteriaDefinition:
var bookFilter
= new CriteriaDefinition<>(sessionFactory, Book.class) {{
where(like(from(Book.class).get(Book_.title), "%Hibernate%"));
}};
long count
= new CriteriaDefinition<>(bookFilter, Long.class) {{
select(count());
}}
.createSelectionQuery(session)
.getSingleResult();
var books =
= new CriteriaDefinition<>(bookFilter) {{
var book = (Root<Book>) getRootList().get(0);
book.fetch(Book_.authors);
orderBy(desc(book.get(Book_.publicationDate)), asc(book.get(Book_.isbn)));
}}
.createSelectionQuery(session)
.setMaxResults(10)
.getResultList();
- Since:
- 6.3
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface CriteriaBuilder
CriteriaBuilder.Case<R>, CriteriaBuilder.Coalesce<T>, CriteriaBuilder.In<T>, CriteriaBuilder.SimpleCase<C,R>, CriteriaBuilder.Trimspec -
Constructor Summary
ConstructorsConstructorDescriptionCriteriaDefinition(CriteriaQuery<R> baseQuery) CriteriaDefinition(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(CriteriaDefinition<?> template, Class<R> resultType) Construct a newCriteriaDefinitionbased on the givenCriteriaDefinition.CriteriaDefinition(CriteriaDefinition<R> template) Construct a newCriteriaDefinitionbased on the givenCriteriaDefinition, with the same query return type.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.A query that returnstrueif this query has any results.createQuery(EntityManager entityManager) distinct(boolean distinct) Set whether duplicate query results are eliminated.Set the query fetch limit.fetch(Number fetch, FetchClauseType fetchClauseType) Set the query fetch limit.fetch(JpaExpression<? extends Number> fetch) Set the query fetch limit.fetch(JpaExpression<? extends Number> fetch, FetchClauseType fetchClauseType) Set the query fetch limit.<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 a query root for the given entity type.<X> JpaRoot<X> Create a query root for the given entity type.<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.<X> JpaFunctionRoot<X> from(JpaSetReturningFunction<X> function) Create and add a query root corresponding to the given set-returning function, forming a cartesian product with any existing roots.Return the criteria builder that created this query.<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()Return the query fetch expression.Return the fetch clause type.List<Expression<?>> Return the group restriction.Return the query offset expression.The query structure.The query structure.Return the restriction predicate.<E> JpaRoot<? extends E> Get a query root element at the given position with the given type.<E> JpaRoot<? extends E> Get a query root element with the given alias and the given type.Return the roots as a list.getRoots()Return the query selection.groupBy(Expression... grouping) Set the grouping expressions.groupBy(List<Expression<?>> grouping) Set the grouping expressions.having(BooleanExpression... restrictions) Set the group restriction.having(Expression<Boolean> restriction) Set the group restriction.having(List<? extends Expression<Boolean>> restrictions) Set the group restriction.booleanmultiselect(Selection<?>... selections) Deprecated.multiselect(List<Selection<?>> list) Deprecated.Set the query offset.offset(JpaExpression<? extends Number> offset) Set the query offset.Set the ordering expressions.Set the ordering expressions.Set the query selection.<U> JpaSubQuery<U> subquery(EntityType<U> type) Create a subquery for the given entity type.<U> JpaSubQuery<U> Create a subquery with the given result type.where(BooleanExpression... restrictions) Set the restriction.where(Expression<Boolean> restriction) Set the restriction.where(List<? extends Expression<Boolean>> restrictions) Set the restriction.<T> JpaCteCriteria<T> with(AbstractQuery<T> criteria) Deprecated, for removal: This API element is subject to removal in a future version.<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 HibernateCriteriaBuilderDelegate
abs, acos, addDuration, addDuration, addDuration, all, and, and, and, and, any, array, array, array, array, arrayAgg, arrayAgg, arrayAgg, arrayAgg, arrayAppend, arrayAppend, arrayConcat, arrayConcat, arrayConcat, arrayContains, arrayContains, arrayContains, arrayContainsNullable, arrayContainsNullable, arrayContainsNullable, arrayFill, arrayFill, arrayFill, arrayFill, arrayGet, arrayGet, arrayIncludes, arrayIncludes, arrayIncludes, arrayIncludesNullable, arrayIncludesNullable, arrayIncludesNullable, arrayIntersects, arrayIntersects, arrayIntersects, arrayIntersectsNullable, arrayIntersectsNullable, arrayIntersectsNullable, arrayLength, arrayLiteral, arrayPosition, arrayPosition, arrayPositions, arrayPositions, arrayPositionsList, arrayPositionsList, arrayPrepend, arrayPrepend, arrayRemove, arrayRemove, arrayRemoveIndex, arrayRemoveIndex, arrayReplace, arrayReplace, arrayReplace, arrayReplace, arrayReverse, arraySet, arraySet, arraySet, arraySet, arraySlice, arraySlice, arraySlice, arraySlice, arraySort, arraySort, arraySort, arraySort, arraySort, arrayToString, arrayToString, arrayToString, arrayToString, arrayToString, arrayToString, arrayTrim, arrayTrim, asc, asc, asc, asc, asc, asin, atan, atan2, atan2, atan2, augment, augment, augment, avg, avg, avg, avg, between, between, between, booleanLiteral, cast, cast, castTarget, castTarget, castTarget, ceiling, coalesce, coalesce, coalesce, collate, collectionAppend, collectionAppend, collectionConcat, collectionConcat, collectionConcat, collectionContains, collectionContains, collectionContains, collectionContainsNullable, collectionContainsNullable, collectionContainsNullable, collectionFill, collectionFill, collectionFill, collectionFill, collectionGet, collectionGet, collectionIncludes, collectionIncludes, collectionIncludes, collectionIncludesNullable, collectionIncludesNullable, collectionIncludesNullable, collectionIntersects, collectionIntersects, collectionIntersects, collectionIntersectsNullable, collectionIntersectsNullable, collectionIntersectsNullable, collectionLength, collectionLiteral, collectionPosition, collectionPosition, collectionPositions, collectionPositions, collectionPositionsList, collectionPositionsList, collectionPrepend, collectionPrepend, collectionRemove, collectionRemove, collectionRemoveIndex, collectionRemoveIndex, collectionReplace, collectionReplace, collectionReplace, collectionReplace, collectionReverse, collectionSet, collectionSet, collectionSet, collectionSet, collectionSlice, collectionSlice, collectionSlice, collectionSlice, collectionSort, collectionSort, collectionSort, collectionSort, collectionSort, collectionToString, collectionToString, collectionToString, collectionToString, collectionToString, collectionToString, collectionTrim, collectionTrim, concat, concat, concat, concat, concat, conjunction, construct, construct, convertedParameter, cos, cosh, count, count, count, count, count, countDistinct, createCriteriaDelete, createCriteriaDelete, createCriteriaDelete, createCriteriaInsertSelect, createCriteriaInsertValues, createCriteriaUpdate, createCriteriaUpdate, createCriteriaUpdate, createQuery, createQuery, createQuery, createQuery, createQuery, createTupleQuery, createWindow, cumeDist, currentDate, currentInstant, currentTime, currentTimestamp, day, degrees, denseRank, desc, 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, except, except, exceptAll, exceptAll, exceptAll, exceptAll, exists, exp, extract, firstValue, fk, floor, format, frameBetweenFollowing, frameBetweenFollowing, frameBetweenPreceding, frameBetweenPreceding, frameCurrentRow, frameUnboundedFollowing, frameUnboundedPreceding, function, functionAggregate, functionAggregate, functionAggregate, functionWithinGroup, functionWithinGroup, functionWithinGroup, functionWithinGroup, ge, ge, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateSeries, generateTimeSeries, generateTimeSeries, generateTimeSeries, generateTimeSeries, generateTimeSeries, generateTimeSeries, generateTimeSeries, generateTimeSeries, greaterThan, greaterThan, greaterThanOrEqualTo, greaterThanOrEqualTo, greatest, greatest, greatest, gt, gt, hour, id, ilike, ilike, ilike, ilike, ilike, ilike, ilikeRegexp, in, in, in, in, indexes, intersect, intersect, intersect, intersect, intersect, intersect, intersectAll, intersectAll, intersectAll, intersectAll, isEmpty, isFalse, isMapEmpty, isMapNotEmpty, isMember, isMember, isNotEmpty, isNotMember, isNotMember, isNotNull, isNull, isTrue, jsonArray, jsonArrayAgg, jsonArrayAgg, jsonArrayAgg, jsonArrayAgg, jsonArrayAggWithNulls, jsonArrayAggWithNulls, jsonArrayAggWithNulls, jsonArrayAggWithNulls, jsonArrayWithNulls, jsonExists, jsonExists, jsonInsert, jsonInsert, jsonInsert, jsonInsert, jsonMergepatch, jsonMergepatch, jsonMergepatch, jsonObject, jsonObjectAgg, jsonObjectAgg, jsonObjectAggWithNulls, jsonObjectAggWithNulls, jsonObjectAggWithUniqueKeys, jsonObjectAggWithUniqueKeys, jsonObjectAggWithUniqueKeysAndNulls, jsonObjectAggWithUniqueKeysAndNulls, jsonObjectWithNulls, jsonQuery, jsonQuery, jsonRemove, jsonRemove, jsonReplace, jsonReplace, jsonReplace, jsonReplace, jsonSet, jsonSet, jsonSet, jsonSet, jsonTable, jsonTable, jsonTable, jsonValue, jsonValue, jsonValue, jsonValue, lastValue, le, le, least, least, least, left, left, length, lessThan, lessThan, lessThanOrEqualTo, lessThanOrEqualTo, like, like, like, like, like, like, likeRegexp, listagg, listagg, listagg, listagg, listagg, listagg, listagg, listagg, listParameter, listParameter, 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, named, neg, not, notDistinctFrom, notDistinctFrom, notEqual, notEqual, notIlike, notIlike, notIlike, notIlike, notIlike, notIlike, notIlikeRegexp, notLike, notLike, notLike, notLike, notLike, notLike, notLikeRegexp, nthValue, nthValue, nullif, nullif, nullLiteral, numericLiteral, or, or, 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, selectCase, selectCase, setReturningFunction, sign, sin, sinh, size, size, some, sort, sort, sort, sort, sql, sqrt, stringLiteral, substring, substring, substring, substring, subtractDuration, subtractDuration, subtractDuration, sum, sum, sum, sum, sum, sum, sum, sumAsDouble, sumAsLong, tan, tanh, temporalLiteral, toBigDecimal, toBigInteger, toDouble, toFloat, toInteger, toLong, toString, treat, treat, treat, treat, treat, treat, treat, treat, trim, trim, trim, trim, trim, trim, truncate, truncate, tuple, tuple, union, union, union, union, union, union, unionAll, unionAll, unionAll, unionAll, unnestArray, unnestCollection, unwrap, upper, value, values, values, version, windowFunction, wrap, wrap, wrap, xmlagg, xmlagg, xmlagg, xmlagg, xmlcomment, xmlconcat, xmlconcat, xmlelement, xmlexists, xmlexists, xmlforest, xmlforest, xmlpi, xmlpi, xmlquery, xmlquery, xmlTable, xmlTable, year
-
Constructor Details
-
CriteriaDefinition
Construct a newCriteriaDefinitionbased on the givenCriteriaDefinition, with the same query return type.- Parameters:
template- the original query- Since:
- 7.0
-
CriteriaDefinition
Construct a newCriteriaDefinitionbased on the givenCriteriaDefinition. This overload permits changing the query return type. It is expected thatselect(Selection)be called to rewrite the selection list.- Parameters:
template- the original queryresultType- the new return type- Since:
- 7.0
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
CriteriaDefinition
-
-
Method Details
-
createQuery
-
restrict
-
getCriteriaBuilder
Description copied from interface:JpaCriteriaQueryReturn the criteria builder that created this query.- Specified by:
getCriteriaBuilderin interfaceJpaCriteriaQuery<R>- Overrides:
getCriteriaBuilderin classHibernateCriteriaBuilderDelegate
-
select
Description copied from interface:JpaCriteriaQuerySet the query selection.- Specified by:
selectin interfaceCriteriaQuery<R>- Specified by:
selectin interfaceJpaCriteriaQuery<R>
-
multiselect
Deprecated.Description copied from interface:JpaCriteriaQuerySet the compound query selection.- Specified by:
multiselectin interfaceCriteriaQuery<R>- Specified by:
multiselectin interfaceJpaCriteriaQuery<R>
-
multiselect
Deprecated.Description copied from interface:JpaCriteriaQuerySet the compound query selection.- Specified by:
multiselectin interfaceCriteriaQuery<R>- Specified by:
multiselectin interfaceJpaCriteriaQuery<R>
-
where
Description copied from interface:JpaCriteriaQuerySet the restriction.- Specified by:
wherein interfaceAbstractQuery<R>- Specified by:
wherein interfaceCriteriaQuery<R>- Specified by:
wherein interfaceJpaCriteriaQuery<R>- Specified by:
wherein interfaceJpaSelectCriteria<R>
-
groupBy
Description copied from interface:JpaCriteriaQuerySet the grouping expressions.- Specified by:
groupByin interfaceAbstractQuery<R>- Specified by:
groupByin interfaceCriteriaQuery<R>- Specified by:
groupByin interfaceJpaCriteriaQuery<R>- Specified by:
groupByin interfaceJpaSelectCriteria<R>
-
groupBy
Description copied from interface:JpaCriteriaQuerySet the grouping expressions.- Specified by:
groupByin interfaceAbstractQuery<R>- Specified by:
groupByin interfaceCriteriaQuery<R>- Specified by:
groupByin interfaceJpaCriteriaQuery<R>- Specified by:
groupByin interfaceJpaSelectCriteria<R>
-
having
Description copied from interface:JpaCriteriaQuerySet the group restriction.- Specified by:
havingin interfaceAbstractQuery<R>- Specified by:
havingin interfaceCriteriaQuery<R>- Specified by:
havingin interfaceJpaCriteriaQuery<R>- Specified by:
havingin interfaceJpaSelectCriteria<R>
-
orderBy
Description copied from interface:JpaCriteriaQuerySet the ordering expressions.- Specified by:
orderByin interfaceCriteriaQuery<R>- Specified by:
orderByin interfaceJpaCriteriaQuery<R>
-
orderBy
Description copied from interface:JpaCriteriaQuerySet the ordering expressions.- Specified by:
orderByin interfaceCriteriaQuery<R>- Specified by:
orderByin interfaceJpaCriteriaQuery<R>
-
distinct
Description copied from interface:JpaCriteriaQuerySet whether duplicate query results are eliminated.- Specified by:
distinctin interfaceAbstractQuery<R>- Specified by:
distinctin interfaceCriteriaQuery<R>- Specified by:
distinctin interfaceJpaCriteriaQuery<R>- Specified by:
distinctin interfaceJpaSelectCriteria<R>
-
getOrderList
- Specified by:
getOrderListin interfaceCriteriaQuery<R>
-
getParameters
Description copied from interface:JpaCriteriaQuery- Specified by:
getParametersin interfaceCommonAbstractCriteria- Specified by:
getParametersin interfaceJpaCriteriaQuery<R>
-
from
Description copied from interface:JpaCriteriaQueryCreate a query root for the given entity type.- Specified by:
fromin interfaceAbstractQuery<R>- Specified by:
fromin interfaceJpaCriteriaQuery<R>- Specified by:
fromin interfaceJpaSelectCriteria<R>
-
from
Description copied from interface:JpaCriteriaQueryCreate a query root for the given entity type.- Specified by:
fromin interfaceAbstractQuery<R>- Specified by:
fromin interfaceJpaCriteriaQuery<R>- Specified by:
fromin interfaceJpaSelectCriteria<R>
-
subquery
Description copied from interface:JpaCriteriaBaseCreate a subquery with the given result type.- Specified by:
subqueryin interfaceCommonAbstractCriteria- Specified by:
subqueryin interfaceJpaCriteriaBase
-
getRoots
-
getSelection
Description copied from interface:JpaSelectCriteriaReturn the query selection.- Specified by:
getSelectionin interfaceAbstractQuery<R>- Specified by:
getSelectionin interfaceJpaSelectCriteria<R>
-
getGroupList
- Specified by:
getGroupListin interfaceAbstractQuery<R>
-
getGroupRestriction
Description copied from interface:JpaSelectCriteriaReturn the group restriction.- Specified by:
getGroupRestrictionin interfaceAbstractQuery<R>- Specified by:
getGroupRestrictionin interfaceJpaSelectCriteria<R>
-
isDistinct
public boolean isDistinct()- Specified by:
isDistinctin interfaceAbstractQuery<R>
-
getResultType
- Specified by:
getResultTypein interfaceAbstractQuery<R>
-
getRestriction
Description copied from interface:JpaCriteriaBaseReturn the restriction predicate.- Specified by:
getRestrictionin interfaceCommonAbstractCriteria- Specified by:
getRestrictionin interfaceJpaCriteriaBase- Specified by:
getRestrictionin interfaceJpaSelectCriteria<R>
-
where
@Nonnull public JpaCriteriaQuery<R> where(@Nonnull List<? extends Expression<Boolean>> restrictions) Description copied from interface:JpaCriteriaQuerySet the restriction.- Specified by:
wherein interfaceAbstractQuery<R>- Specified by:
wherein interfaceCriteriaQuery<R>- Specified by:
wherein interfaceJpaCriteriaQuery<R>- Specified by:
wherein interfaceJpaSelectCriteria<R>
-
where
Description copied from interface:JpaCriteriaQuerySet the restriction.- Specified by:
wherein interfaceAbstractQuery<R>- Specified by:
wherein interfaceCriteriaQuery<R>- Specified by:
wherein interfaceJpaCriteriaQuery<R>- Specified by:
wherein interfaceJpaSelectCriteria<R>
-
having
Description copied from interface:JpaCriteriaQuerySet the group restriction.- Specified by:
havingin interfaceAbstractQuery<R>- Specified by:
havingin interfaceCriteriaQuery<R>- Specified by:
havingin interfaceJpaCriteriaQuery<R>- Specified by:
havingin interfaceJpaSelectCriteria<R>
-
having
@Nonnull public JpaCriteriaQuery<R> having(@Nonnull List<? extends Expression<Boolean>> restrictions) Description copied from interface:JpaCriteriaQuerySet the group restriction.- Specified by:
havingin interfaceAbstractQuery<R>- Specified by:
havingin interfaceCriteriaQuery<R>- Specified by:
havingin interfaceJpaCriteriaQuery<R>- Specified by:
havingin interfaceJpaSelectCriteria<R>
-
subquery
Description copied from interface:JpaCriteriaQueryCreate a subquery for the given entity type.- Specified by:
subqueryin interfaceCommonAbstractCriteria- Specified by:
subqueryin interfaceJpaCriteriaQuery<R>
-
getOffset
Description copied from interface:JpaCriteriaQueryReturn the query offset expression.- Specified by:
getOffsetin interfaceJpaCriteriaQuery<R>
-
offset
Description copied from interface:JpaCriteriaQuerySet the query offset.- Specified by:
offsetin interfaceJpaCriteriaQuery<R>
-
offset
Description copied from interface:JpaCriteriaQuerySet the query offset.- Specified by:
offsetin interfaceJpaCriteriaQuery<R>
-
getFetch
Description copied from interface:JpaCriteriaQueryReturn the query fetch expression.- Specified by:
getFetchin interfaceJpaCriteriaQuery<R>
-
fetch
Description copied from interface:JpaCriteriaQuerySet the query fetch limit.- Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
fetch
@Nonnull public JpaCriteriaQuery<R> fetch(@Nullable JpaExpression<? extends Number> fetch, @Nonnull FetchClauseType fetchClauseType) Description copied from interface:JpaCriteriaQuerySet the query fetch limit.- Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
fetch
Description copied from interface:JpaCriteriaQuerySet the query fetch limit.- Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
fetch
@Nonnull public JpaCriteriaQuery<R> fetch(@Nullable Number fetch, @Nonnull FetchClauseType fetchClauseType) Description copied from interface:JpaCriteriaQuerySet the query fetch limit.- Specified by:
fetchin interfaceJpaCriteriaQuery<R>
-
getFetchClauseType
Description copied from interface:JpaCriteriaQueryReturn the fetch clause type.- Specified by:
getFetchClauseTypein interfaceJpaCriteriaQuery<R>
-
getRootList
Description copied from interface:JpaCriteriaQueryReturn the roots as a list.- Specified by:
getRootListin interfaceAbstractQuery<R>- Specified by:
getRootListin interfaceJpaCriteriaQuery<R>
-
getRoot
Description copied from interface:JpaCriteriaQueryGet a query root element at the given position with the given type.- Specified by:
getRootin interfaceJpaCriteriaQuery<R>- Parameters:
position- the position of this root elementtype- the type of the root entity
-
getRoot
Description copied from interface:JpaCriteriaQueryGet a query root element with the given alias and the given type.- Specified by:
getRootin interfaceJpaCriteriaQuery<R>- Parameters:
alias- the identification variable of the root elementtype- the type of the root entity
-
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
@Deprecated(since="7", forRemoval=true) @Nonnull public <T> JpaCteCriteria<T> with(@Nonnull AbstractQuery<T> criteria) Deprecated, for removal: This API element is subject to removal in a future version.Description copied from interface:JpaCteContainerRegisters the givenCriteriaQueryand returns aJpaCteCriteria, which can be used for querying.- Specified by:
within interfaceJpaCteContainer- See Also:
-
withRecursiveUnionAll
@Nonnull public <T> JpaCteCriteria<T> withRecursiveUnionAll(@Nonnull AbstractQuery<T> baseCriteria, @Nonnull 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
@Nonnull public <T> JpaCteCriteria<T> withRecursiveUnionDistinct(@Nonnull AbstractQuery<T> baseCriteria, @Nonnull 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
@Nonnull public <T> JpaCteCriteria<T> with(@Nonnull String name, @Nonnull AbstractQuery<T> criteria) Description copied from interface:JpaCteContainerLikeJpaCteContainer.with(AbstractQuery)but assigns an explicit CTE name.- Specified by:
within interfaceJpaCteContainer
-
withRecursiveUnionAll
@Nonnull public <T> JpaCteCriteria<T> withRecursiveUnionAll(@Nonnull String name, @Nonnull AbstractQuery<T> baseCriteria, @Nonnull 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
@Nonnull public <T> JpaCteCriteria<T> withRecursiveUnionDistinct(@Nonnull String name, @Nonnull AbstractQuery<T> baseCriteria, @Nonnull 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
-
from
Description copied from interface:JpaSelectCriteriaCreate and add a query root corresponding to the given set-returning function, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceJpaSelectCriteria<R>- Parameters:
function- the set-returning function- Returns:
- query root corresponding to the given function
-
createCountQuery
Description copied from interface:JpaCriteriaQueryA query that returns the number of results of this query.- Specified by:
createCountQueryin interfaceJpaCriteriaQuery<R>- See Also:
-
createExistsQuery
Description copied from interface:JpaCriteriaQueryA query that returnstrueif this query has any results.- Specified by:
createExistsQueryin interfaceJpaCriteriaQuery<R>