Module org.eclipse.persistence.jpa
Class SubQueryImpl<T>
java.lang.Object
org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl<T>
org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl<T>
org.eclipse.persistence.internal.jpa.querydef.SubQueryImpl<T>
- All Implemented Interfaces:
AbstractQuery<T>,CommonAbstractCriteria,Expression<T>,Selection<T>,Subquery<T>,TupleElement<T>,Serializable,InternalExpression,InternalSelection
public class SubQueryImpl<T>
extends AbstractQueryImpl<T>
implements Subquery<T>, InternalExpression, InternalSelection
Purpose: Contains the implementation of the SubQuery interface of the JPA criteria API.
Description: This is the container class for the components that define a query to be used in a sub select expression.
- Since:
- EclipseLink 2.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl
AbstractQueryImpl.ResultType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Set<Expression> protected SubSelectExpressionprotected CommonAbstractCriteriaprotected SelectionImpl<?> protected ReportQueryFields inherited from class org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImpl
baseExpression, distinct, groupBy, havingClause, queryResult, rootsFields inherited from class org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl
metamodel, parameters, queryBuilder, queryType, where -
Constructor Summary
ConstructorsConstructorDescriptionSubQueryImpl(Metamodel metamodel, Class<T> result, CriteriaBuilderImpl queryBuilder, CommonAbstractCriteria parent) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddParameter(ParameterExpression<?> parameter) Assign an alias to the selection.<X> Expression<X> <X,Y> CollectionJoin <X, Y> correlate(CollectionJoin<X, Y> parentCollection) Correlates a join to a Collection-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.<X,Y> Join <X, Y> Correlates a join object of the enclosing query to a join object of the subquery and returns the subquery join object.<X,Y> ListJoin <X, Y> Correlates a join to a List-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.<X,K, V> MapJoin <X, K, V> Correlates a join to a Map-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.<Y> Root<Y> Correlates a root of the enclosing query to a root of the subquery and returns the subquery root.<X,Y> SetJoin <X, Y> Correlates a join to a Set-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object.distinct(boolean distinct) Specify whether duplicate query results will be eliminated.voidgetAlias()protected ExpressionReturn selection items composing a compound selectionReturn the joins that have been made from the subquery.Returns the current EclipseLink expression at this node in the criteria expression treeReturn the parameters of the queryReturn the query of which this is a subquery.Return the selection item of the query.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.in(Expression<?>... values) Apply a predicate to test whether the expression is a member of the argument list.in(Expression<Collection<?>> values) Apply a predicate to test whether the expression is a member of the collection.in(Collection<?> values) Apply a predicate to test whether the expression is a member of the collection.protected voidintegrateRoot(RootImpl root) Used to use a root from a different query.protected ExpressioninternalCorrelate(FromImpl from) booleanbooleanWhether the selection item is a compound selectionbooleanbooleanbooleanisFrom()booleanbooleanisNull()booleanbooleanbooleanisRoot()booleanselect(Expression<T> selection) Specify the item that is to be returned in the query result.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.AbstractQueryImpl
findJoins, from, from, getBaseExpression, getGroupList, getGroupRestriction, getRoots, isDistinctMethods inherited from class org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImpl
findRootAndParameters, findRootAndParameters, getRestriction, getResultType, internalFrom, internalFrom, subquery, translateMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.persistence.criteria.AbstractQuery
from, from, getGroupList, getGroupRestriction, getResultType, getRoots, isDistinctMethods inherited from interface jakarta.persistence.criteria.CommonAbstractCriteria
getRestriction, subquery
-
Field Details
-
selection
-
currentNode
-
alias
-
subQuery
-
parent
-
processedJoins
-
correlations
-
-
Constructor Details
-
SubQueryImpl
public SubQueryImpl(Metamodel metamodel, Class<T> result, CriteriaBuilderImpl queryBuilder, CommonAbstractCriteria parent)
-
-
Method Details
-
select
Specify the item that is to be returned in the query result. Replaces the previously specified selection, if any. -
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:
wherein interfaceAbstractQuery<T>- Specified by:
wherein interfaceSubquery<T>- Overrides:
wherein classAbstractQueryImpl<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:
wherein interfaceAbstractQuery<T>- Specified by:
wherein interfaceSubquery<T>- Overrides:
wherein classAbstractQueryImpl<T>- Parameters:
restrictions- zero or more restriction predicates- 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. This method only overrides the return type of the corresponding AbstractQuery method.- Specified by:
groupByin interfaceAbstractQuery<T>- Specified by:
groupByin interfaceSubquery<T>- Overrides:
groupByin classAbstractQueryImpl<T>- 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. This method only overrides the return type of the corresponding AbstractQuery method.- Specified by:
groupByin interfaceAbstractQuery<T>- Specified by:
groupByin interfaceSubquery<T>- Overrides:
groupByin classAbstractQueryImpl<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. This method only overrides the return type of the corresponding AbstractQuery method.- Specified by:
havingin interfaceAbstractQuery<T>- Specified by:
havingin interfaceSubquery<T>- Overrides:
havingin classAbstractQueryImpl<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. This method only overrides the return type of the corresponding AbstractQuery method.- Specified by:
havingin interfaceAbstractQuery<T>- Specified by:
havingin interfaceSubquery<T>- Overrides:
havingin classAbstractQueryImpl<T>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-
correlate
Correlates a root of the enclosing query to a root of the subquery and returns the subquery root. -
correlate
Correlates a join object of the enclosing query to a join object of the subquery and returns the subquery join object. -
correlate
Correlates a join to a Collection-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object. -
correlate
Correlates a join to a Set-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object. -
correlate
Correlates a join to a List-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object. -
correlate
Correlates a join to a Map-valued association or element collection in the enclosing query to a join object of the subquery and returns the subquery join object. -
internalCorrelate
-
getParameters
Description copied from class:CommonAbstractCriteriaImplReturn the parameters of the query- Overrides:
getParametersin classCommonAbstractCriteriaImpl<T>- Returns:
- the query parameters
-
getParent
Return the query of which this is a subquery. -
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 interfaceAbstractQuery<T>- Specified by:
distinctin interfaceSubquery<T>- Overrides:
distinctin classAbstractQueryImpl<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.
-
getCurrentNode
Returns the current EclipseLink expression at this node in the criteria expression tree- Specified by:
getCurrentNodein interfaceInternalSelection- Returns:
- the currentNode
-
getSelection
Return the selection item of the query. This will correspond to the query type.- Specified by:
getSelectionin interfaceAbstractQuery<T>- Specified by:
getSelectionin interfaceSubquery<T>- Returns:
- the selection item of the query
-
addParameter
- Overrides:
addParameterin classCommonAbstractCriteriaImpl<T>
-
addJoin
- Specified by:
addJoinin classAbstractQueryImpl<T>
-
as
- Specified by:
asin interfaceExpression<T>
-
in
- Specified by:
inin interfaceExpression<T>
-
in
Apply a predicate to test whether the expression is a member of the argument list.- Specified by:
inin interfaceExpression<T>- Returns:
- predicate testing for membership
-
in
Apply a predicate to test whether the expression is a member of the collection.- Specified by:
inin interfaceExpression<T>- Parameters:
values- collection- Returns:
- predicate testing for membership
-
in
Apply a predicate to test whether the expression is a member of the collection.- Specified by:
inin interfaceExpression<T>- Parameters:
values- expression corresponding to collection- Returns:
- predicate testing for membership
-
isNotNull
- Specified by:
isNotNullin interfaceExpression<T>
-
isNull
- Specified by:
isNullin interfaceExpression<T>
-
alias
Assign an alias to the selection. -
getAlias
- Specified by:
getAliasin interfaceTupleElement<T>
-
getJavaType
- Specified by:
getJavaTypein interfaceTupleElement<T>
-
getCompoundSelectionItems
Return selection items composing a compound selection- Specified by:
getCompoundSelectionItemsin interfaceSelection<T>- Returns:
- list of selection items
- Throws:
IllegalStateException- if selection is not a compound selection
-
isCompoundSelection
public boolean isCompoundSelection()Whether the selection item is a compound selection- Specified by:
isCompoundSelectionin interfaceSelection<T>- Returns:
- boolean
-
isConstructor
public boolean isConstructor()- Specified by:
isConstructorin interfaceInternalSelection
-
isJunction
public boolean isJunction()- Specified by:
isJunctionin interfaceInternalExpression
-
isPredicate
public boolean isPredicate()- Specified by:
isPredicatein interfaceInternalExpression
-
isParameter
public boolean isParameter()- Specified by:
isParameterin interfaceInternalExpression
-
isRoot
public boolean isRoot()- Specified by:
isRootin interfaceInternalSelection
-
isSubquery
public boolean isSubquery()- Specified by:
isSubqueryin interfaceInternalExpression
-
integrateRoot
Description copied from class:CommonAbstractCriteriaImplUsed to use a root from a different query.- Overrides:
integrateRootin classAbstractQueryImpl<T>
-
isCompoundExpression
public boolean isCompoundExpression()- Specified by:
isCompoundExpressionin interfaceInternalExpression
-
isExpression
public boolean isExpression()- Specified by:
isExpressionin interfaceInternalExpression
-
isFrom
public boolean isFrom()- Specified by:
isFromin interfaceInternalSelection
-
isLiteral
public boolean isLiteral()- Specified by:
isLiteralin interfaceInternalExpression
-
findRootAndParameters
- Specified by:
findRootAndParametersin interfaceInternalSelection
-
getBaseExpression
- Overrides:
getBaseExpressionin classAbstractQueryImpl<T>
-
getContainingQuery
- Specified by:
getContainingQueryin interfaceSubquery<T>
-
getDatabaseQuery
- Specified by:
getDatabaseQueryin classCommonAbstractCriteriaImpl<T>
-