Module org.eclipse.persistence.jpa
Class AbstractQueryImpl<T>
java.lang.Object
org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl<T>
org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl<T>
- All Implemented Interfaces:
AbstractQuery<T>
,CommonAbstractCriteria
,Serializable
- Direct Known Subclasses:
CriteriaQueryImpl
,SubQueryImpl
public abstract class AbstractQueryImpl<T>
extends CommonAbstractCriteriaImpl<T>
implements AbstractQuery<T>
Purpose: Contains the implementation of the AbstractQuery interface of the JPA criteria API.
Description: This is the container class for the components that define a query. This is the superclass of both the CriteriaQuery and the SubQuery.
- Since:
- EclipseLink 1.2
- See Also:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected Expression
protected boolean
protected List
<Expression<?>> protected Predicate
protected AbstractQueryImpl.ResultType
Fields inherited from class org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl
metamodel, parameters, queryBuilder, queryType, where
-
Constructor Summary
ConstructorDescriptionAbstractQueryImpl
(Metamodel metamodel, AbstractQueryImpl.ResultType queryResult, CriteriaBuilderImpl queryBuilder, Class<T> resultType) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
distinct
(boolean distinct) Specify whether duplicate query results will be eliminated.protected void
<X> Root
<X> from
(EntityType<X> entity) Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.<X> Root
<X> Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.protected Expression
protected Expression
getBaseExpression
(Root root) List
<Expression<?>> Return a list of the grouping expressionsReturn the predicate that corresponds to the restriction(s) over the grouping items.getRoots()
Return the query roots.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.protected void
integrateRoot
(RootImpl root) Used to use a root from a different query.boolean
Return whether duplicate query results must be eliminated or retained.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.Methods inherited from class org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl
addParameter, findRootAndParameters, findRootAndParameters, getDatabaseQuery, getParameters, getRestriction, getResultType, internalFrom, internalFrom, subquery, translate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface jakarta.persistence.criteria.AbstractQuery
getResultType, getSelection
Methods inherited from interface jakarta.persistence.criteria.CommonAbstractCriteria
getRestriction, subquery
-
Field Details
-
queryResult
-
distinct
protected boolean distinct -
havingClause
-
groupBy
-
roots
-
baseExpression
-
-
Constructor Details
-
AbstractQueryImpl
public AbstractQueryImpl(Metamodel metamodel, AbstractQueryImpl.ResultType queryResult, CriteriaBuilderImpl queryBuilder, Class<T> resultType)
-
-
Method Details
-
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.- Specified by:
groupBy
in interfaceAbstractQuery<T>
- Parameters:
grouping
- list of 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.- Specified by:
groupBy
in interfaceAbstractQuery<T>
- Parameters:
grouping
- zero or more grouping expressions- Returns:
- the modified query
-
having
Specify a restriction over the groups of the query. Replaces the previous having restriction(s), if any.- Specified by:
having
in interfaceAbstractQuery<T>
- 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 restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.- Specified by:
having
in interfaceAbstractQuery<T>
- Parameters:
restrictions
- zero or more restriction predicates- Returns:
- the modified query
-
addJoin
-
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.- Specified by:
distinct
in 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.
-
getBaseExpression
- Specified by:
getBaseExpression
in classCommonAbstractCriteriaImpl<T>
-
getBaseExpression
-
getGroupList
Return a list of the grouping expressions- Specified by:
getGroupList
in interfaceAbstractQuery<T>
- Returns:
- the list of grouping expressions
-
getGroupRestriction
Return the predicate that corresponds to the restriction(s) over the grouping items.- Specified by:
getGroupRestriction
in interfaceAbstractQuery<T>
- Returns:
- having clause predicate
-
getRoots
Return the query roots.- Specified by:
getRoots
in interfaceAbstractQuery<T>
- Returns:
- the set of query roots
-
integrateRoot
Description copied from class:CommonAbstractCriteriaImpl
Used to use a root from a different query.- Specified by:
integrateRoot
in classCommonAbstractCriteriaImpl<T>
-
isDistinct
public boolean isDistinct()Return whether duplicate query results must be eliminated or retained.- Specified by:
isDistinct
in interfaceAbstractQuery<T>
- Returns:
- boolean indicating whether duplicate query results must be eliminated
-
findJoins
-
from
Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.- Specified by:
from
in interfaceAbstractQuery<T>
- Parameters:
entity
- metamodel entity representing the entity of type X- Returns:
- query root corresponding to the given entity
-
from
Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.- Specified by:
from
in interfaceAbstractQuery<T>
- Parameters:
entityClass
- the entity class- Returns:
- query root corresponding to the given entity
-
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.- Specified by:
where
in interfaceAbstractQuery<T>
- Overrides:
where
in classCommonAbstractCriteriaImpl<T>
- Parameters:
restriction
- 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. This method only overrides the return type of the corresponding AbstractQuery method.- Specified by:
where
in interfaceAbstractQuery<T>
- Overrides:
where
in classCommonAbstractCriteriaImpl<T>
- Parameters:
restrictions
- zero or more restriction predicates- Returns:
- the modified query
-