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 SummaryNested classes/interfaces inherited from class org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImplAbstractQueryImpl.ResultType
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Stringprotected Set<Expression> protected SubSelectExpressionprotected CommonAbstractCriteriaprotected SelectionImpl<?> protected ReportQueryFields inherited from class org.eclipse.persistence.internal.jpa.querydef.AbstractQueryImplbaseExpression, distinct, groupBy, havingClause, queryResult, rootsFields inherited from class org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImplmetamodel, parameters, queryBuilder, queryType, where
- 
Constructor SummaryConstructorsConstructorDescriptionSubQueryImpl(Metamodel metamodel, Class<T> result, CriteriaBuilderImpl queryBuilder, CommonAbstractCriteria parent) 
- 
Method SummaryModifier 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.AbstractQueryImplfindJoins, from, from, getBaseExpression, getGroupList, getGroupRestriction, getRoots, isDistinctMethods inherited from class org.eclipse.persistence.internal.jpa.querydef.CommonAbstractCriteriaImplfindRootAndParameters, findRootAndParameters, getRestriction, getResultType, internalFrom, internalFrom, subquery, translateMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.persistence.criteria.AbstractQueryfrom, from, getGroupList, getGroupRestriction, getResultType, getRoots, isDistinctMethods inherited from interface jakarta.persistence.criteria.CommonAbstractCriteriagetRestriction, subquery
- 
Field Details- 
selection
- 
currentNode
- 
alias
- 
subQuery
- 
parent
- 
processedJoins
- 
correlations
 
- 
- 
Constructor Details- 
SubQueryImplpublic SubQueryImpl(Metamodel metamodel, Class<T> result, CriteriaBuilderImpl queryBuilder, CommonAbstractCriteria parent) 
 
- 
- 
Method Details- 
selectSpecify the item that is to be returned in the query result. Replaces the previously specified selection, if any.
- 
whereModify 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 interface- AbstractQuery<T>
- Specified by:
- wherein interface- Subquery<T>
- Overrides:
- wherein class- AbstractQueryImpl<T>
- Parameters:
- restriction- a simple or compound boolean expression
- Returns:
- the modified query
 
- 
whereModify 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 interface- AbstractQuery<T>
- Specified by:
- wherein interface- Subquery<T>
- Overrides:
- wherein class- AbstractQueryImpl<T>
- Parameters:
- restrictions- zero or more restriction predicates
- Returns:
- the modified query
 
- 
groupBySpecify 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 interface- AbstractQuery<T>
- Specified by:
- groupByin interface- Subquery<T>
- Overrides:
- groupByin class- AbstractQueryImpl<T>
- Parameters:
- grouping- zero or more grouping expressions
- Returns:
- the modified query
 
- 
groupBySpecify 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 interface- AbstractQuery<T>
- Specified by:
- groupByin interface- Subquery<T>
- Overrides:
- groupByin class- AbstractQueryImpl<T>
- Parameters:
- grouping- zero or more grouping expressions
- Returns:
- the modified query
 
- 
havingSpecify 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 interface- AbstractQuery<T>
- Specified by:
- havingin interface- Subquery<T>
- Overrides:
- havingin class- AbstractQueryImpl<T>
- Parameters:
- restriction- a simple or compound boolean expression
- Returns:
- the modified query
 
- 
havingSpecify 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 interface- AbstractQuery<T>
- Specified by:
- havingin interface- Subquery<T>
- Overrides:
- havingin class- AbstractQueryImpl<T>
- Parameters:
- restrictions- zero or more restriction predicates
- Returns:
- the modified query
 
- 
correlateCorrelates a root of the enclosing query to a root of the subquery and returns the subquery root.
- 
correlateCorrelates a join object of the enclosing query to a join object of the subquery and returns the subquery join object.
- 
correlateCorrelates 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.
- 
correlateCorrelates 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.
- 
correlateCorrelates 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.
- 
correlateCorrelates 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
- 
getParametersDescription copied from class:CommonAbstractCriteriaImplReturn the parameters of the query- Overrides:
- getParametersin class- CommonAbstractCriteriaImpl<T>
- Returns:
- the query parameters
 
- 
getParentReturn the query of which this is a subquery.
- 
distinctSpecify 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 interface- AbstractQuery<T>
- Specified by:
- distinctin interface- Subquery<T>
- Overrides:
- distinctin class- AbstractQueryImpl<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.
 
- 
getCurrentNodeReturns the current EclipseLink expression at this node in the criteria expression tree- Specified by:
- getCurrentNodein interface- InternalSelection
- Returns:
- the currentNode
 
- 
getSelectionReturn the selection item of the query. This will correspond to the query type.- Specified by:
- getSelectionin interface- AbstractQuery<T>
- Specified by:
- getSelectionin interface- Subquery<T>
- Returns:
- the selection item of the query
 
- 
addParameter- Overrides:
- addParameterin class- CommonAbstractCriteriaImpl<T>
 
- 
addJoin- Specified by:
- addJoinin class- AbstractQueryImpl<T>
 
- 
as- Specified by:
- asin interface- Expression<T>
 
- 
in- Specified by:
- inin interface- Expression<T>
 
- 
inApply a predicate to test whether the expression is a member of the argument list.- Specified by:
- inin interface- Expression<T>
- Returns:
- predicate testing for membership
 
- 
inApply a predicate to test whether the expression is a member of the collection.- Specified by:
- inin interface- Expression<T>
- Parameters:
- values- collection
- Returns:
- predicate testing for membership
 
- 
inApply a predicate to test whether the expression is a member of the collection.- Specified by:
- inin interface- Expression<T>
- Parameters:
- values- expression corresponding to collection
- Returns:
- predicate testing for membership
 
- 
isNotNull- Specified by:
- isNotNullin interface- Expression<T>
 
- 
isNull- Specified by:
- isNullin interface- Expression<T>
 
- 
aliasAssign an alias to the selection.
- 
getAlias- Specified by:
- getAliasin interface- TupleElement<T>
 
- 
getJavaType- Specified by:
- getJavaTypein interface- TupleElement<T>
 
- 
getCompoundSelectionItemsReturn selection items composing a compound selection- Specified by:
- getCompoundSelectionItemsin interface- Selection<T>
- Returns:
- list of selection items
- Throws:
- IllegalStateException- if selection is not a compound selection
 
- 
isCompoundSelectionpublic boolean isCompoundSelection()Whether the selection item is a compound selection- Specified by:
- isCompoundSelectionin interface- Selection<T>
- Returns:
- boolean
 
- 
isConstructorpublic boolean isConstructor()- Specified by:
- isConstructorin interface- InternalSelection
 
- 
isJunctionpublic boolean isJunction()- Specified by:
- isJunctionin interface- InternalExpression
 
- 
isPredicatepublic boolean isPredicate()- Specified by:
- isPredicatein interface- InternalExpression
 
- 
isParameterpublic boolean isParameter()- Specified by:
- isParameterin interface- InternalExpression
 
- 
isRootpublic boolean isRoot()- Specified by:
- isRootin interface- InternalSelection
 
- 
isSubquerypublic boolean isSubquery()- Specified by:
- isSubqueryin interface- InternalExpression
 
- 
integrateRootDescription copied from class:CommonAbstractCriteriaImplUsed to use a root from a different query.- Overrides:
- integrateRootin class- AbstractQueryImpl<T>
 
- 
isCompoundExpressionpublic boolean isCompoundExpression()- Specified by:
- isCompoundExpressionin interface- InternalExpression
 
- 
isExpressionpublic boolean isExpression()- Specified by:
- isExpressionin interface- InternalExpression
 
- 
isFrompublic boolean isFrom()- Specified by:
- isFromin interface- InternalSelection
 
- 
isLiteralpublic boolean isLiteral()- Specified by:
- isLiteralin interface- InternalExpression
 
- 
findRootAndParameters- Specified by:
- findRootAndParametersin interface- InternalSelection
 
- 
getBaseExpression- Overrides:
- getBaseExpressionin class- AbstractQueryImpl<T>
 
- 
getContainingQuery- Specified by:
- getContainingQueryin interface- Subquery<T>
 
- 
getDatabaseQuery- Specified by:
- getDatabaseQueryin class- CommonAbstractCriteriaImpl<T>
 
 
-