Top Description Fields Constructors Methods
org.eclipse.persistence.internal.jpa.querydef

public Class CriteriaQueryImpl<T>

extends AbstractQueryImpl<T>
implements CriteriaQuery<T>
Class Inheritance
All Implemented Interfaces
jakarta.persistence.criteria.CriteriaQuery, jakarta.persistence.criteria.AbstractQuery, jakarta.persistence.criteria.CommonAbstractCriteria
Imports
java.lang.reflect.Constructor, java.security.AccessController, java.util.*, jakarta.persistence.Tuple, jakarta.persistence.criteria.CriteriaQuery, .Expression, .Order, .Predicate, .Root, .Selection, jakarta.persistence.metamodel.Metamodel, .Type.PersistenceType, org.eclipse.persistence.expressions.ExpressionBuilder, org.eclipse.persistence.internal.helper.BasicTypeHelperImpl, .ClassConstants, org.eclipse.persistence.internal.jpa.metamodel.MetamodelImpl, .TypeImpl, org.eclipse.persistence.internal.localization.ExceptionLocalization, org.eclipse.persistence.internal.security.PrivilegedAccessHelper, .PrivilegedGetConstructorFor, org.eclipse.persistence.queries.DatabaseQuery, .ObjectLevelReadQuery, .ReadAllQuery, .ReportQuery

Purpose: Contains the implementation of the CriteriaQuery interface of the JPA criteria API.

Description: This is the container class for the components that define a query.

Author
gyorke
Since
EclipseLink 1.2
See Also
CriteriaQuery

Field Summary

Modifier and TypeField and Description
protected Set<FromImpl<Z, X>>
protected List<Order>
protected SelectionImpl<?>
Inherited from org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl:
baseExpressiondistinctgroupByhavingClausequeryResultroots

Constructor Summary

AccessConstructor and Description
public
CriteriaQueryImpl(Metamodel metamodel, AbstractQueryImpl.ResultType queryResult, Class<T> result, CriteriaBuilderImpl queryBuilder)

Method Summary

Modifier and TypeMethod and Description
public void
protected ObjectLevelReadQuery
createCompoundQuery()

Translates from the criteria query to a EclipseLink Database Query.

protected ObjectLevelReadQuery
public CriteriaQuery<T>

Returns:

the modified query.
distinct
(boolean
boolean value specifying whether duplicate results must be eliminated from the query result or whether they must be retained
distinct
)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.distinct.

Implements jakarta.persistence.criteria.CriteriaQuery.distinct, jakarta.persistence.criteria.AbstractQuery.distinct.

Specify whether duplicate query results will be eliminated.
protected DatabaseQuery
public List<Order>

Returns:

the list of ordering expressions
getOrderList
()

Implements jakarta.persistence.criteria.CriteriaQuery.getOrderList.

Return the ordering expressions in order of precedence.
public Selection<T>

Returns:

the selection item of the query
getSelection
()

Implements jakarta.persistence.criteria.AbstractQuery.getSelection.

Return the selection item of the query.
public CriteriaQuery<T>

Returns:

the modified query
groupBy
(Expression<?>...
zero or more grouping expressions
grouping
)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.groupBy.

Implements jakarta.persistence.criteria.CriteriaQuery.groupBy, jakarta.persistence.criteria.AbstractQuery.groupBy.

Specify the expressions that are used to form groups over the query results.
public CriteriaQuery<T>

Returns:

the modified query
groupBy
(List<Expression<?>>
list of zero or more grouping expressions
grouping
)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.groupBy.

Implements jakarta.persistence.criteria.CriteriaQuery.groupBy, jakarta.persistence.criteria.AbstractQuery.groupBy.

Specify the expressions that are used to form groups over the query results.
public CriteriaQuery<T>

Returns:

the modified query
having
(Expression<Boolean>
a simple or compound boolean expression
restriction
)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.having.

Implements jakarta.persistence.criteria.CriteriaQuery.having, jakarta.persistence.criteria.AbstractQuery.having.

Specify a restriction over the groups of the query.
public CriteriaQuery<T>

Returns:

the modified query
having
(Predicate...
zero or more restriction predicates
restrictions
)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.having.

Implements jakarta.persistence.criteria.CriteriaQuery.having, jakarta.persistence.criteria.AbstractQuery.having.

Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates.
public CriteriaQuery<T>

Returns:

the modified query
multiselect
(Selection<?>...
expressions specifying the items that are to be returned in the query result
selections
)

Implements jakarta.persistence.criteria.CriteriaQuery.multiselect.

Specify the items that are to be returned in the query result.
public CriteriaQuery<T>

Returns:

the modified query
multiselect
(List<Selection<?>>
list of expressions specifying the items that to be are returned in the query result
selectionList
)

Implements jakarta.persistence.criteria.CriteriaQuery.multiselect.

Specify the items that are to be returned in the query result.
public CriteriaQuery<T>

Returns:

the modified query.
orderBy
(Order...
zero or more ordering expressions
o
)

Implements jakarta.persistence.criteria.CriteriaQuery.orderBy.

Specify the ordering expressions that are used to order the query results.
public CriteriaQuery<T>

Returns:

the modified query.
orderBy
(List<Order>
list of zero or more ordering expressions
o
)

Implements jakarta.persistence.criteria.CriteriaQuery.orderBy.

Specify the ordering expressions that are used to order the query results.
public void
populateAndSetConstructorSelection(ConstructorSelectionImpl constructorSelection, Class<?> class1, Selection<?>... selections)

This method will set this queryImpl's selection to a ConstructorSelectionImpl, creating a new instance or populating the one passed in as necessary.

public CriteriaQuery<T>

Returns:

the modified query
select
(Selection<? extends T>
selection specifying the item that is to be returned in the query result
selection
)

Implements jakarta.persistence.criteria.CriteriaQuery.select.

Specify the item that is to be returned in the query result.
public DatabaseQuery
translate()

Overrides org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl.translate.

Translates from the criteria query to a EclipseLink Database Query.
public CriteriaQuery<T>

Returns:

the modified query
where
(Expression<Boolean>
a simple or compound boolean expression
restriction
)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.where.

Implements jakarta.persistence.criteria.CriteriaQuery.where, jakarta.persistence.criteria.AbstractQuery.where.

Modify the query to restrict the query result according to the specified boolean expression.
public CriteriaQuery<T>

Returns:

the modified query
where
(Predicate...
zero or more restriction predicates
restrictions
)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.where.

Implements jakarta.persistence.criteria.CriteriaQuery.where, jakarta.persistence.criteria.AbstractQuery.where.

Modify the query to restrict the query result according to the conjunction of the specified restriction predicates.
Inherited from org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl:
findJoinsfromfromgetBaseExpressiongetBaseExpressiongetGroupListgetGroupRestrictiongetRootsintegrateRootisDistinct

Field Detail

joinsback to summary
protected Set<FromImpl<Z, X>> joins
orderByback to summary
protected List<Order> orderBy
selectionback to summary
protected SelectionImpl<?> selection

Constructor Detail

CriteriaQueryImplback to summary
public CriteriaQueryImpl(Metamodel metamodel, AbstractQueryImpl.ResultType queryResult, Class<T> result, CriteriaBuilderImpl queryBuilder)

Method Detail

addJoinback to summary
public void addJoin(FromImpl<Z, X> from)

Implements abstract org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.addJoin.

Annotations
@Override
createCompoundQueryback to summary
protected ObjectLevelReadQuery createCompoundQuery()

Translates from the criteria query to a EclipseLink Database Query.

Annotations
@SuppressWarnings:deprecation
createSimpleQueryback to summary
protected ObjectLevelReadQuery createSimpleQuery()
distinctback to summary
public CriteriaQuery<T> distinct(boolean distinct)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.distinct.

Implements jakarta.persistence.criteria.CriteriaQuery.distinct, jakarta.persistence.criteria.AbstractQuery.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. This method only overrides the return type of the corresponding AbstractQuery method.

Parameters
distinct:boolean

boolean value specifying whether duplicate results must be eliminated from the query result or whether they must be retained

Returns:CriteriaQuery<T>

the modified query.

Annotations
@Override
getDatabaseQueryback to summary
protected DatabaseQuery getDatabaseQuery()

Implements abstract org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl.getDatabaseQuery.

Annotations
@Override
getOrderListback to summary
public List<Order> getOrderList()

Implements jakarta.persistence.criteria.CriteriaQuery.getOrderList.

Return the ordering expressions in order of precedence.

Returns:List<Order>

the list of ordering expressions

Annotations
@Override
getSelectionback to summary
public Selection<T> getSelection()

Implements jakarta.persistence.criteria.AbstractQuery.getSelection.

Return the selection item of the query. This will correspond to the query type.

Returns:Selection<T>

the selection item of the query

Annotations
@Override
groupByback to summary
public CriteriaQuery<T> groupBy(Expression<?>... grouping)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.groupBy.

Implements jakarta.persistence.criteria.CriteriaQuery.groupBy, jakarta.persistence.criteria.AbstractQuery.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. This method only overrides the return type of the corresponding AbstractQuery method.

Parameters
grouping:Expression<?>[]

zero or more grouping expressions

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
groupByback to summary
public CriteriaQuery<T> groupBy(List<Expression<?>> grouping)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.groupBy.

Implements jakarta.persistence.criteria.CriteriaQuery.groupBy, jakarta.persistence.criteria.AbstractQuery.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. This method only overrides the return type of the corresponding AbstractQuery method.

Parameters
grouping:List<Expression<?>>

list of zero or more grouping expressions

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
havingback to summary
public CriteriaQuery<T> having(Expression<Boolean> restriction)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.having.

Implements jakarta.persistence.criteria.CriteriaQuery.having, jakarta.persistence.criteria.AbstractQuery.having.

Specify 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 corresponding AbstractQuery method.

Parameters
restriction:Expression<Boolean>

a simple or compound boolean expression

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
havingback to summary
public CriteriaQuery<T> having(Predicate... restrictions)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.having.

Implements jakarta.persistence.criteria.CriteriaQuery.having, jakarta.persistence.criteria.AbstractQuery.having.

Specify restrictions over the groups of the query according 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 corresponding AbstractQuery method.

Parameters
restrictions:Predicate[]

zero or more restriction predicates

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
multiselectback to summary
public CriteriaQuery<T> multiselect(Selection<?>... selections)

Implements jakarta.persistence.criteria.CriteriaQuery.multiselect.

Specify the 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 criteria query object as well as the arguments to the multiselect method as follows: If the type of the criteria query is CriteriaQuery<Tuple>, a Tuple object corresponding to the arguments of the multiselect method 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, then the arguments to the multiselect method will be passed to the X constructor and an instance of type X will be returned for each row. The IllegalStateException will be thrown if a constructor for the given argument types does not exist. 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 the multiselect method. The IllegalStateException will be thrown if the arguments to the multiselect method are not of type X. If the type of the criteria query is CriteriaQuery<Object>, and only a single argument is passed to the multiselect method, an instance of type Object will be returned for each row. If the type of the criteria query is CriteriaQuery<Object>, and more than one argument is passed to the multiselect method, an instance of type Object[] will be instantiated and returned for each row. The elements of the array will correspond to the arguments to the multiselect method.

Parameters
selections:Selection<?>[]

expressions specifying the items that are to be returned in the query result

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
multiselectback to summary
public CriteriaQuery<T> multiselect(List<Selection<?>> selectionList)

Implements jakarta.persistence.criteria.CriteriaQuery.multiselect.

Specify the 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 criteria query object as well as the arguments to the multiselect method as follows: If the type of the criteria query is CriteriaQuery<Tuple>, a Tuple object corresponding to the items in the selection list passed to the multiselect method 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, then the items in the selection list passed to the multiselect method will be passed to the X constructor and an instance of type X will be returned for each row. The IllegalStateException will be thrown if a constructor for the given argument types does not exist. 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 items in the selection list passed to the multiselect method. The IllegalStateException will be thrown if the elements in the selection list passed to the multiselect method are not of type X. If the type of the criteria query is CriteriaQuery<Object>, and the selection list passed to the multiselect method contains only a single item, an instance of type Object will be returned for each row. If the type of the criteria query is CriteriaQuery<Object>, and the selection list passed to the multiselect method contains more than one item, an instance of type Object[] will be instantiated and returned for each row. The elements of the array will correspond to the items in the selection list passed to the multiselect method.

Parameters
selectionList:List<Selection<?>>

list of expressions specifying the items that to be are returned in the query result

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
orderByback to summary
public CriteriaQuery<T> orderBy(Order... o)

Implements jakarta.persistence.criteria.CriteriaQuery.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:Order[]

zero or more ordering expressions

Returns:CriteriaQuery<T>

the modified query.

Annotations
@Override
orderByback to summary
public CriteriaQuery<T> orderBy(List<Order> o)

Implements jakarta.persistence.criteria.CriteriaQuery.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 order of the ordering expressions in the list determines the precedence, whereby the first element in the list has highest precedence.

Parameters
o:List<Order>

list of zero or more ordering expressions

Returns:CriteriaQuery<T>

the modified query.

Annotations
@Override
populateAndSetConstructorSelectionback to summary
public void populateAndSetConstructorSelection(ConstructorSelectionImpl constructorSelection, Class<?> class1, Selection<?>... selections) throws IllegalArgumentException

This method will set this queryImpl's selection to a ConstructorSelectionImpl, creating a new instance or populating the one passed in as necessary. Throws IllegalArgumentException if a constructor taking arguments represented by the selections array doesn't exist for the given class. Also sets the query result to ResultType.CONSTRUCTOR

selectback to summary
public CriteriaQuery<T> select(Selection<? extends T> selection)

Implements jakarta.persistence.criteria.CriteriaQuery.select.

Specify the item that is to be returned in the query result. Replaces the previously specified selection, if any.

Parameters
selection:Selection<? extends T>

selection specifying the item that is to be returned in the query result

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
translateback to summary
public DatabaseQuery translate()

Overrides org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl.translate.

Translates from the criteria query to a EclipseLink Database Query.

Annotations
@Override
whereback to summary
public CriteriaQuery<T> where(Expression<Boolean> restriction)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.where.

Implements jakarta.persistence.criteria.CriteriaQuery.where, jakarta.persistence.criteria.AbstractQuery.where.

Modify 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 corresponding AbstractQuery method.

Parameters
restriction:Expression<Boolean>

a simple or compound boolean expression

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override
whereback to summary
public CriteriaQuery<T> where(Predicate... restrictions)

Overrides org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl.where.

Implements jakarta.persistence.criteria.CriteriaQuery.where, jakarta.persistence.criteria.AbstractQuery.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. This method only overrides the return type of the corresponding AbstractQuery method.

Parameters
restrictions:Predicate[]

zero or more restriction predicates

Returns:CriteriaQuery<T>

the modified query

Annotations
@Override