Interface CriteriaQuery<T>
- Type Parameters:
T
- Query result type
- All Known Implementing Classes:
CriteriaQueryImpl
public interface CriteriaQuery<T>
Interface used to control the execution of typed queries.
-
Method Summary
Modifier and TypeMethodDescriptiondistinct()
Specify that duplicates query results will be eliminated.distinct
(boolean distinct) Specify whether duplicate query results will be eliminated.<X> Root<X>
from
(EntityType<X> entity) Create and add a query root corresponding to the given entity type.<X> Root<X>
Create and add a query root corresponding to the given entity class.Return the ordering expressions in order of precedence.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.boolean
Return whether duplicate query results must be eliminated or retained.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.where
(Expression<Boolean> expression) 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.Modify the query to restrict the query result according to the conjunction of the specified restriction predicates.
-
Method Details
-
from
Create and add a query root corresponding to the given entity class.- Parameters:
entityClass
- the entity class- Returns:
- query root corresponding to the given entity
-
from
Create and add a query root corresponding to the given entity type.- Parameters:
entity
- metamodel entity representing the entity of type X- Returns:
- query root corresponding to the given entity
-
select
Specify the item that is to be returned in the query result. Replaces the previously specified selection(s), if any.- Parameters:
selection
- - selection specifying the item that is to be returned in the query result- Returns:
- the modified query
-
where
Modify the query to restrict the query result according to the specified boolean expression. Replaces the previously added restriction(s), if any.- Parameters:
expression
- - a simple or compound boolean expression- Returns:
- the modified query
-
where
Modify 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.- Parameters:
predicates
- - zero or more restriction predicates- Returns:
- the modified query
-
where
Modify 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.- Parameters:
predicates
- - list of predicates- Returns:
- the modified query
-
getResultType
-
distinct
Specify 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.- 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
-
distinct
CriteriaQuery<T> distinct()Specify that duplicates query results will be eliminated.- Returns:
- the modified query
-
isDistinct
boolean isDistinct()Return whether duplicate query results must be eliminated or retained.- Returns:
- boolean indicating whether duplicate query results must be eliminated
-
getSelection
Return the selection of the query, or null if no selection has been set.- Returns:
- selection item
-
getRestriction
Predicate getRestriction()Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.- Returns:
- where clause predicate
-
groupBy
Specify 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.- Parameters:
grouping
- zero or more grouping expressions- Returns:
- the modified query
-
groupBy
Specify 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.- Parameters:
grouping
- list of zero or more grouping expressions- Returns:
- the modified query
-
orderBy
Specify 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.- Parameters:
o
- list of zero or more ordering expressions- Returns:
- the modified query
-
orderBy
Specify 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.- Parameters:
o
- zero or more ordering expressions- Returns:
- the modified query
-
getOrderList
Return the ordering expressions in order of precedence. Returns empty list if no ordering expressions have been specified.- Returns:
- the list of ordering expressions
-
having
Specify a restriction over the groups of the query. Replaces the previous having restriction(s), if any.- Parameters:
restriction
- a simple or compound boolean expression- Returns:
- the modified query
-
having
Specify 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.- Parameters:
restrictions
- zero or more restriction predicates- Returns:
- the modified query
-