Package org.hibernate.query.criteria
Interface JpaSelectCriteria<T>
- All Superinterfaces:
AbstractQuery<T>,CommonAbstractCriteria,JpaCriteriaBase,JpaCriteriaNode,Serializable
- All Known Subinterfaces:
JpaCriteriaQuery<T>,JpaSubQuery<T>,SqmSelectQuery<T>
- All Known Implementing Classes:
AbstractSqmSelectQuery,CriteriaDefinition,SqmSelectStatement,SqmSubQuery
Commonality between a JPA
JpaCriteriaQuery and JpaSubQuery,
mainly in the form of delegation to JpaQueryStructure- Author:
- Steve Ebersole
-
Method Summary
Modifier and TypeMethodDescriptiondistinct(boolean distinct) Specify whether duplicate query results will be eliminated.<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.Return the predicate that corresponds to the restriction(s) over the grouping items, or null if no restrictions have been specified.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 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.where(Expression<Boolean> restriction) Modify the query to restrict the query results according to the specified boolean expression.Modify the query to restrict the query results according to the conjunction of the specified restriction predicates.Methods inherited from interface jakarta.persistence.criteria.AbstractQuery
getGroupList, getResultType, getRoots, isDistinctMethods inherited from interface org.hibernate.query.criteria.JpaCriteriaBase
subquery
-
Method Details
-
getQuerySpec
JpaQueryStructure<T> getQuerySpec()The query structure. SeeJpaQueryStructurefor details -
getQueryPart
JpaQueryPart<T> getQueryPart()The query structure. SeeJpaQueryStructurefor details -
from
Create and add a query root corresponding to the given subquery, forming a cartesian product with any existing roots.- Parameters:
subquery- the subquery- Returns:
- query root corresponding to the given subquery
-
from
Create and add a query root corresponding to the given cte, forming a cartesian product with any existing roots.- Parameters:
cte- the cte criteria- Returns:
- query root corresponding to the given cte
-
distinct
Description copied from interface:AbstractQuerySpecify 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.- Specified by:
distinctin interfaceAbstractQuery<T>- 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
-
getSelection
JpaSelection<T> getSelection()Description copied from interface:AbstractQueryReturn the selection of the query, or null if no selection has been set.- Specified by:
getSelectionin interfaceAbstractQuery<T>- Returns:
- selection item
-
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<T>- 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<T>- Parameters:
entity- metamodel entity representing the entity of type X- Returns:
- query root corresponding to the given entity
-
getRestriction
JpaPredicate 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- Returns:
- where clause predicate
-
where
Description copied from interface:AbstractQueryModify the query to restrict the query results according to the specified boolean expression. Replaces the previously added restriction(s), if any.- Specified by:
wherein interfaceAbstractQuery<T>- Parameters:
restriction- a simple or compound boolean expression- Returns:
- the modified query
-
where
Description copied from interface:AbstractQueryModify the query to restrict the query results 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.- Specified by:
wherein interfaceAbstractQuery<T>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-
groupBy
Description copied from interface:AbstractQuerySpecify 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.- Specified by:
groupByin interfaceAbstractQuery<T>- Parameters:
grouping- zero or more grouping expressions- Returns:
- the modified query
-
groupBy
Description copied from interface:AbstractQuerySpecify 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.- Specified by:
groupByin interfaceAbstractQuery<T>- Parameters:
grouping- list of zero or more grouping expressions- Returns:
- the modified query
-
getGroupRestriction
JpaPredicate 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<T>- Returns:
- having clause predicate
-
having
Description copied from interface:AbstractQuerySpecify a restriction over the groups of the query. Replaces the previous having restriction(s), if any.- Specified by:
havingin interfaceAbstractQuery<T>- Parameters:
restriction- a simple or compound boolean expression- Returns:
- the modified query
-
having
Description copied from interface:AbstractQuerySpecify restrictions over the groups of the query according the conjunction of the specified restriction predicates. Replaces the previously having added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.- Specified by:
havingin interfaceAbstractQuery<T>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-