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:
java.io.Serializable,javax.persistence.criteria.AbstractQuery<T>,javax.persistence.criteria.CommonAbstractCriteria
- Direct Known Subclasses:
CriteriaQueryImpl,SubQueryImpl
public abstract class AbstractQueryImpl<T> extends CommonAbstractCriteriaImpl<T> implements javax.persistence.criteria.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
- Author:
- gyorke
- See Also:
CriteriaQuery, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classAbstractQueryImpl.ResultType
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.persistence.expressions.ExpressionbaseExpressionprotected booleandistinctprotected java.util.List<javax.persistence.criteria.Expression<?>>groupByprotected javax.persistence.criteria.PredicatehavingClauseprotected AbstractQueryImpl.ResultTypequeryResultprotected java.util.Set<javax.persistence.criteria.Root<?>>roots-
Fields inherited from class org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl
metamodel, parameters, queryBuilder, queryType, where
-
-
Constructor Summary
Constructors Constructor Description AbstractQueryImpl(javax.persistence.metamodel.Metamodel metamodel, AbstractQueryImpl.ResultType queryResult, CriteriaBuilderImpl queryBuilder, java.lang.Class<T> resultType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidaddJoin(FromImpl join)javax.persistence.criteria.AbstractQuery<T>distinct(boolean distinct)Specify whether duplicate query results will be eliminated.protected voidfindJoins(FromImpl root)<X> javax.persistence.criteria.Root<X>from(java.lang.Class<X> entityClass)Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.<X> javax.persistence.criteria.Root<X>from(javax.persistence.metamodel.EntityType<X> entity)Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.protected org.eclipse.persistence.expressions.ExpressiongetBaseExpression()protected org.eclipse.persistence.expressions.ExpressiongetBaseExpression(javax.persistence.criteria.Root root)java.util.List<javax.persistence.criteria.Expression<?>>getGroupList()Return a list of the grouping expressionsjavax.persistence.criteria.PredicategetGroupRestriction()Return the predicate that corresponds to the restriction(s) over the grouping items.java.util.Set<javax.persistence.criteria.Root<?>>getRoots()Return the query roots.javax.persistence.criteria.AbstractQuery<T>groupBy(java.util.List<javax.persistence.criteria.Expression<?>> grouping)Specify the expressions that are used to form groups over the query results.javax.persistence.criteria.AbstractQuery<T>groupBy(javax.persistence.criteria.Expression<?>... grouping)Specify the expressions that are used to form groups over the query results.javax.persistence.criteria.AbstractQuery<T>having(javax.persistence.criteria.Expression<java.lang.Boolean> restriction)Specify a restriction over the groups of the query.javax.persistence.criteria.AbstractQuery<T>having(javax.persistence.criteria.Predicate... restrictions)Specify restrictions over the groups of the query according the conjunction of the specified restriction predicates.protected voidintegrateRoot(RootImpl root)Used to use a root from a different query.booleanisDistinct()Return whether duplicate query results must be eliminated or retained.javax.persistence.criteria.AbstractQuery<T>where(javax.persistence.criteria.Expression<java.lang.Boolean> restriction)Modify the query to restrict the query result according to the specified boolean expression.javax.persistence.criteria.AbstractQuery<T>where(javax.persistence.criteria.Predicate... restrictions)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
-
-
-
-
Field Detail
-
queryResult
protected AbstractQueryImpl.ResultType queryResult
-
distinct
protected boolean distinct
-
havingClause
protected javax.persistence.criteria.Predicate havingClause
-
groupBy
protected java.util.List<javax.persistence.criteria.Expression<?>> groupBy
-
roots
protected java.util.Set<javax.persistence.criteria.Root<?>> roots
-
baseExpression
protected org.eclipse.persistence.expressions.Expression baseExpression
-
-
Constructor Detail
-
AbstractQueryImpl
public AbstractQueryImpl(javax.persistence.metamodel.Metamodel metamodel, AbstractQueryImpl.ResultType queryResult, CriteriaBuilderImpl queryBuilder, java.lang.Class<T> resultType)
-
-
Method Detail
-
groupBy
public javax.persistence.criteria.AbstractQuery<T> groupBy(java.util.List<javax.persistence.criteria.Expression<?>> grouping)
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:
groupByin interfacejavax.persistence.criteria.AbstractQuery<T>- Parameters:
grouping- list of zero or more grouping expressions- Returns:
- the modified query
-
groupBy
public javax.persistence.criteria.AbstractQuery<T> groupBy(javax.persistence.criteria.Expression<?>... grouping)
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:
groupByin interfacejavax.persistence.criteria.AbstractQuery<T>- Parameters:
grouping- zero or more grouping expressions- Returns:
- the modified query
-
having
public javax.persistence.criteria.AbstractQuery<T> having(javax.persistence.criteria.Expression<java.lang.Boolean> restriction)
Specify a restriction over the groups of the query. Replaces the previous having restriction(s), if any.- Specified by:
havingin interfacejavax.persistence.criteria.AbstractQuery<T>- Parameters:
restriction- a simple or compound boolean expression- Returns:
- the modified query
-
having
public javax.persistence.criteria.AbstractQuery<T> having(javax.persistence.criteria.Predicate... restrictions)
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:
havingin interfacejavax.persistence.criteria.AbstractQuery<T>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-
addJoin
public abstract void addJoin(FromImpl join)
-
distinct
public javax.persistence.criteria.AbstractQuery<T> distinct(boolean 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:
distinctin interfacejavax.persistence.criteria.AbstractQuery<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
protected org.eclipse.persistence.expressions.Expression getBaseExpression()
- Specified by:
getBaseExpressionin classCommonAbstractCriteriaImpl<T>
-
getBaseExpression
protected org.eclipse.persistence.expressions.Expression getBaseExpression(javax.persistence.criteria.Root root)
-
getGroupList
public java.util.List<javax.persistence.criteria.Expression<?>> getGroupList()
Return a list of the grouping expressions- Specified by:
getGroupListin interfacejavax.persistence.criteria.AbstractQuery<T>- Returns:
- the list of grouping expressions
-
getGroupRestriction
public javax.persistence.criteria.Predicate getGroupRestriction()
Return the predicate that corresponds to the restriction(s) over the grouping items.- Specified by:
getGroupRestrictionin interfacejavax.persistence.criteria.AbstractQuery<T>- Returns:
- having clause predicate
-
getRoots
public java.util.Set<javax.persistence.criteria.Root<?>> getRoots()
Return the query roots.- Specified by:
getRootsin interfacejavax.persistence.criteria.AbstractQuery<T>- Returns:
- the set of query roots
-
integrateRoot
protected void integrateRoot(RootImpl root)
Description copied from class:CommonAbstractCriteriaImplUsed to use a root from a different query.- Specified by:
integrateRootin classCommonAbstractCriteriaImpl<T>
-
isDistinct
public boolean isDistinct()
Return whether duplicate query results must be eliminated or retained.- Specified by:
isDistinctin interfacejavax.persistence.criteria.AbstractQuery<T>- Returns:
- boolean indicating whether duplicate query results must be eliminated
-
findJoins
protected void findJoins(FromImpl root)
-
from
public <X> javax.persistence.criteria.Root<X> from(javax.persistence.metamodel.EntityType<X> entity)
Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.- Specified by:
fromin interfacejavax.persistence.criteria.AbstractQuery<T>- Parameters:
entity- metamodel entity representing the entity of type X- Returns:
- query root corresponding to the given entity
-
from
public <X> javax.persistence.criteria.Root<X> from(java.lang.Class<X> entityClass)
Add a query root corresponding to the given entity, forming a Cartesian product with any existing roots.- Specified by:
fromin interfacejavax.persistence.criteria.AbstractQuery<T>- Parameters:
entityClass- the entity class- Returns:
- query root corresponding to the given entity
-
where
public javax.persistence.criteria.AbstractQuery<T> where(javax.persistence.criteria.Expression<java.lang.Boolean> restriction)
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:
wherein interfacejavax.persistence.criteria.AbstractQuery<T>- Overrides:
wherein classCommonAbstractCriteriaImpl<T>- Parameters:
restriction- a simple or compound boolean expression- Returns:
- the modified query
-
where
public javax.persistence.criteria.AbstractQuery<T> where(javax.persistence.criteria.Predicate... restrictions)
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:
wherein interfacejavax.persistence.criteria.AbstractQuery<T>- Overrides:
wherein classCommonAbstractCriteriaImpl<T>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-
-