Top Description Inners Fields Constructors Methods
org.hibernate.query.criteria.internal

public Class CriteriaSubqueryImpl<T>

extends ExpressionImpl<T>
implements Subquery<T>, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, javax.persistence.criteria.Subquery, javax.persistence.criteria.Expression, javax.persistence.criteria.Selection, javax.persistence.TupleElement, javax.persistence.criteria.AbstractQuery, javax.persistence.criteria.CommonAbstractCriteria
Imports
java.io.Serializable, java.util.List, .Set, javax.persistence.criteria.AbstractQuery, .CollectionJoin, .CommonAbstractCriteria, .Expression, .Join, .ListJoin, .MapJoin, .ParameterExpression, .Predicate, .Root, .SetJoin, .Subquery, javax.persistence.metamodel.EntityType, org.hibernate.query.criteria.internal.compile.RenderingContext, org.hibernate.query.criteria.internal.expression.DelegatedExpressionImpl, .ExpressionImpl, org.hibernate.query.criteria.internal.path.RootImpl, org.hibernate.sql.ast.Clause

The Hibernate implementation of the JPA Subquery contract. Mostlty a set of delegation to its internal QueryStructure.
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
private final CommonAbstractCriteria
private final QueryStructure<T>
private Expression<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public <Y> Root<Y>
correlate(Root<Y>
a root of the containing query
source
)

Implements javax.persistence.criteria.Subquery.correlate.

Create a subquery root correlated to a root of the enclosing query.
public <X, Y> Join<X, Y>
correlate(Join<X, Y>
join object of the containing query
source
)

Implements javax.persistence.criteria.Subquery.correlate.

Create a subquery join object correlated to a join object of the enclosing query.
public <X, Y> CollectionJoin<X, Y>
correlate(CollectionJoin<X, Y>
join object of the containing query
source
)

Implements javax.persistence.criteria.Subquery.correlate.

Create a subquery collection join object correlated to a collection join object of the enclosing query.
public <X, Y> SetJoin<X, Y>
correlate(SetJoin<X, Y>
join object of the containing query
source
)

Implements javax.persistence.criteria.Subquery.correlate.

Create a subquery set join object correlated to a set join object of the enclosing query.
public <X, Y> ListJoin<X, Y>
correlate(ListJoin<X, Y>
join object of the containing query
source
)

Implements javax.persistence.criteria.Subquery.correlate.

Create a subquery list join object correlated to a list join object of the enclosing query.
public <X, K, V> MapJoin<X, K, V>
correlate(MapJoin<X, K, V>
join object of the containing query
source
)

Implements javax.persistence.criteria.Subquery.correlate.

Create a subquery map join object correlated to a map join object of the enclosing query.
public Subquery<T>
distinct(boolean
boolean value specifying whether duplicate results must be eliminated from the subquery result or whether they must be retained
applyDistinction
)

Implements javax.persistence.criteria.Subquery.distinct.

Specify whether duplicate query results will be eliminated.
public <X> Root<X>
from(EntityType<X>
metamodel entity representing the entity of type X
entityType
)

Implements javax.persistence.criteria.AbstractQuery.from.

Create and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.
public <X> Root<X>
from(Class<X>
the entity class
entityClass
)

Implements javax.persistence.criteria.AbstractQuery.from.

Create and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.
public CommonAbstractCriteria
getContainingQuery()

Implements javax.persistence.criteria.Subquery.getContainingQuery.

Return the query of which this is a subquery.
public Set<Join<?, ?>>
getCorrelatedJoins()

Implements javax.persistence.criteria.Subquery.getCorrelatedJoins.

Return the correlated joins of the subquery.
public List<Expression<?>>
getGroupList()

Implements javax.persistence.criteria.AbstractQuery.getGroupList.

Return a list of the grouping expressions.
public Predicate
getGroupRestriction()

Implements javax.persistence.criteria.AbstractQuery.getGroupRestriction.

Return the predicate that corresponds to the restriction(s) over the grouping items, or null if no restrictions have been specified.
public AbstractQuery<?>
getParent()

Implements javax.persistence.criteria.Subquery.getParent.

Return the query of which this is a subquery.
public Predicate
getRestriction()

Implements javax.persistence.criteria.CommonAbstractCriteria.getRestriction.

Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.
public Class<T>
getResultType()

Implements javax.persistence.criteria.AbstractQuery.getResultType.

Return the result type of the query or subquery.
public Set<Root<?>>
getRoots()

Implements javax.persistence.criteria.AbstractQuery.getRoots.

Return the query roots.
public Expression<T>
getSelection()

Implements javax.persistence.criteria.Subquery.getSelection.

Return the selection expression.
public Subquery<T>
groupBy(Expression<?>...
zero or more grouping expressions
groupings
)

Implements javax.persistence.criteria.Subquery.groupBy.

Specify the expressions that are used to form groups over the subquery results.
public Subquery<T>
groupBy(List<Expression<?>>
list of zero or more grouping expressions
groupings
)

Implements javax.persistence.criteria.Subquery.groupBy.

Specify the expressions that are used to form groups over the subquery results.
public Subquery<T>
having(Expression<Boolean>
a simple or compound boolean expression
expression
)

Implements javax.persistence.criteria.Subquery.having.

Specify a restriction over the groups of the subquery.
public Subquery<T>
having(Predicate...
zero or more restriction predicates
predicates
)

Implements javax.persistence.criteria.Subquery.having.

Specify restrictions over the groups of the subquery according the conjunction of the specified restriction predicates.
public boolean
isDistinct()

Implements javax.persistence.criteria.AbstractQuery.isDistinct.

Return whether duplicate query results must be eliminated or retained.
public void
registerParameters(ParameterRegistry
The parameter registry with which to register.
registry
)

Implements org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Register any parameters contained within this query component with the given registry.
public String
render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition
public Subquery<T>
select(Expression<T>
expression specifying the item that is to be returned as the subquery result
expression
)

Implements javax.persistence.criteria.Subquery.select.

Specify the item that is to be returned as the subquery result.
public <U> Subquery<U>
subquery(Class<U>
the subquery result type
subqueryType
)

Implements javax.persistence.criteria.CommonAbstractCriteria.subquery.

Create a subquery of the query.
public Subquery<T>
where(Expression<Boolean>
a simple or compound boolean expression
expression
)

Implements javax.persistence.criteria.Subquery.where.

Modify the subquery to restrict the result according to the specified boolean expression.
public Subquery<T>
where(Predicate...
zero or more restriction predicates
predicates
)

Implements javax.persistence.criteria.Subquery.where.

Modify the subquery to restrict the result according to the conjunction of the specified restriction predicates.
Inherited from org.hibernate.query.criteria.internal.expression.ExpressionImpl:
asasBigDecimalasBigIntegerasDoubleasFloatasIntegerasLongasStringininininisNotNullisNull

Field Detail

parentback to summary
private final CommonAbstractCriteria parent
queryStructureback to summary
private final QueryStructure<T> queryStructure
wrappedSelectionback to summary
private Expression<T> wrappedSelection

Constructor Detail

CriteriaSubqueryImplback to summary
public CriteriaSubqueryImpl(CriteriaBuilderImpl criteriaBuilder, Class<T> javaType, CommonAbstractCriteria parent)

Method Detail

correlateback to summary
public <Y> Root<Y> correlate(Root<Y> source)

Implements javax.persistence.criteria.Subquery.correlate.

Doc from javax.persistence.criteria.Subquery.correlate.

Create a subquery root correlated to a root of the enclosing query.

Parameters
source:Root<Y>

a root of the containing query

Returns:Root<Y>

subquery root

Annotations
@Override
correlateback to summary
public <X, Y> Join<X, Y> correlate(Join<X, Y> source)

Implements javax.persistence.criteria.Subquery.correlate.

Doc from javax.persistence.criteria.Subquery.correlate.

Create a subquery join object correlated to a join object of the enclosing query.

Parameters
source:Join<X, Y>

join object of the containing query

Returns:Join<X, Y>

subquery join

Annotations
@Override
correlateback to summary
public <X, Y> CollectionJoin<X, Y> correlate(CollectionJoin<X, Y> source)

Implements javax.persistence.criteria.Subquery.correlate.

Doc from javax.persistence.criteria.Subquery.correlate.

Create a subquery collection join object correlated to a collection join object of the enclosing query.

Parameters
source:CollectionJoin<X, Y>

join object of the containing query

Returns:CollectionJoin<X, Y>

subquery join

Annotations
@Override
correlateback to summary
public <X, Y> SetJoin<X, Y> correlate(SetJoin<X, Y> source)

Implements javax.persistence.criteria.Subquery.correlate.

Doc from javax.persistence.criteria.Subquery.correlate.

Create a subquery set join object correlated to a set join object of the enclosing query.

Parameters
source:SetJoin<X, Y>

join object of the containing query

Returns:SetJoin<X, Y>

subquery join

Annotations
@Override
correlateback to summary
public <X, Y> ListJoin<X, Y> correlate(ListJoin<X, Y> source)

Implements javax.persistence.criteria.Subquery.correlate.

Doc from javax.persistence.criteria.Subquery.correlate.

Create a subquery list join object correlated to a list join object of the enclosing query.

Parameters
source:ListJoin<X, Y>

join object of the containing query

Returns:ListJoin<X, Y>

subquery join

Annotations
@Override
correlateback to summary
public <X, K, V> MapJoin<X, K, V> correlate(MapJoin<X, K, V> source)

Implements javax.persistence.criteria.Subquery.correlate.

Doc from javax.persistence.criteria.Subquery.correlate.

Create a subquery map join object correlated to a map join object of the enclosing query.

Parameters
source:MapJoin<X, K, V>

join object of the containing query

Returns:MapJoin<X, K, V>

subquery join

Annotations
@Override
distinctback to summary
public Subquery<T> distinct(boolean applyDistinction)

Implements javax.persistence.criteria.Subquery.distinct.

Doc from javax.persistence.criteria.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.

Parameters
applyDistinction:boolean

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

Returns:Subquery<T>

the modified subquery.

Annotations
@Override
fromback to summary
public <X> Root<X> from(EntityType<X> entityType)

Implements javax.persistence.criteria.AbstractQuery.from.

Doc from javax.persistence.criteria.AbstractQuery.from.

Create and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.

Parameters
entityType:EntityType<X>

metamodel entity representing the entity of type X

Returns:Root<X>

query root corresponding to the given entity

Annotations
@Override
fromback to summary
public <X> Root<X> from(Class<X> entityClass)

Implements javax.persistence.criteria.AbstractQuery.from.

Doc from javax.persistence.criteria.AbstractQuery.from.

Create and add a query root corresponding to the given entity, forming a cartesian product with any existing roots.

Parameters
entityClass:Class<X>

the entity class

Returns:Root<X>

query root corresponding to the given entity

Annotations
@Override
getContainingQueryback to summary
public CommonAbstractCriteria getContainingQuery()

Implements javax.persistence.criteria.Subquery.getContainingQuery.

Doc from javax.persistence.criteria.Subquery.getContainingQuery.

Return the query of which this is a subquery. This may be a CriteriaQuery, CriteriaUpdate, CriteriaDelete, or a Subquery.

Returns:CommonAbstractCriteria

the enclosing query or subquery

Annotations
@Override
getCorrelatedJoinsback to summary
public Set<Join<?, ?>> getCorrelatedJoins()

Implements javax.persistence.criteria.Subquery.getCorrelatedJoins.

Doc from javax.persistence.criteria.Subquery.getCorrelatedJoins.

Return the correlated joins of the subquery. Returns empty set if the subquery has no correlated joins. Modifications to the set do not affect the query.

Returns:Set<Join<?, ?>>

the correlated joins of the subquery

Annotations
@Override
getGroupListback to summary
public List<Expression<?>> getGroupList()

Implements javax.persistence.criteria.AbstractQuery.getGroupList.

Doc from javax.persistence.criteria.AbstractQuery.getGroupList.

Return a list of the grouping expressions. Returns empty list if no grouping expressions have been specified. Modifications to the list do not affect the query.

Returns:List<Expression<?>>

the list of grouping expressions

Annotations
@Override
getGroupRestrictionback to summary
public Predicate getGroupRestriction()

Implements javax.persistence.criteria.AbstractQuery.getGroupRestriction.

Doc from javax.persistence.criteria.AbstractQuery.getGroupRestriction.

Return the predicate that corresponds to the restriction(s) over the grouping items, or null if no restrictions have been specified.

Returns:Predicate

having clause predicate

Annotations
@Override
getParentback to summary
public AbstractQuery<?> getParent()

Implements javax.persistence.criteria.Subquery.getParent.

Doc from javax.persistence.criteria.Subquery.getParent.

Return the query of which this is a subquery. This must be a CriteriaQuery or a Subquery.

Returns:AbstractQuery<?>

the enclosing query or subquery

Annotations
@Override
getRestrictionback to summary
public Predicate getRestriction()

Implements javax.persistence.criteria.CommonAbstractCriteria.getRestriction.

Doc from javax.persistence.criteria.CommonAbstractCriteria.getRestriction.

Return the predicate that corresponds to the where clause restriction(s), or null if no restrictions have been specified.

Returns:Predicate

where clause predicate

Annotations
@Override
getResultTypeback to summary
public Class<T> getResultType()

Implements javax.persistence.criteria.AbstractQuery.getResultType.

Doc from javax.persistence.criteria.AbstractQuery.getResultType.

Return the result type of the query or subquery. If a result type was specified as an argument to the createQuery or subquery method, that type will be returned. If the query was created using the createTupleQuery method, the result type is Tuple. Otherwise, the result type is Object.

Returns:Class<T>

result type

Annotations
@Override
getRootsback to summary
public Set<Root<?>> getRoots()

Implements javax.persistence.criteria.AbstractQuery.getRoots.

Doc from javax.persistence.criteria.AbstractQuery.getRoots.

Return the query roots. These are the roots that have been defined for the CriteriaQuery or Subquery itself, including any subquery roots defined as a result of correlation. Returns empty set if no roots have been defined. Modifications to the set do not affect the query.

Returns:Set<Root<?>>

the set of query roots

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

Implements javax.persistence.criteria.Subquery.getSelection.

Doc from javax.persistence.criteria.Subquery.getSelection.

Return the selection expression.

Returns:Expression<T>

the item to be returned in the subquery result

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

Implements javax.persistence.criteria.Subquery.groupBy.

Doc from javax.persistence.criteria.Subquery.groupBy.

Specify the expressions that are used to form groups over the subquery 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
groupings:Expression<?>[]

zero or more grouping expressions

Returns:Subquery<T>

the modified subquery

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

Implements javax.persistence.criteria.Subquery.groupBy.

Doc from javax.persistence.criteria.Subquery.groupBy.

Specify the expressions that are used to form groups over the subquery 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
groupings:List<Expression<?>>

list of zero or more grouping expressions

Returns:Subquery<T>

the modified subquery

Annotations
@Override
havingback to summary
public Subquery<T> having(Expression<Boolean> expression)

Implements javax.persistence.criteria.Subquery.having.

Doc from javax.persistence.criteria.Subquery.having.

Specify a restriction over the groups of the subquery. Replaces the previous having restriction(s), if any. This method only overrides the return type of the corresponding AbstractQuery method.

Parameters
expression:Expression<Boolean>

a simple or compound boolean expression

Returns:Subquery<T>

the modified subquery

Annotations
@Override
havingback to summary
public Subquery<T> having(Predicate... predicates)

Implements javax.persistence.criteria.Subquery.having.

Doc from javax.persistence.criteria.Subquery.having.

Specify restrictions over the groups of the subquery according the conjunction of the specified restriction predicates. Replaces the previously added having 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
predicates:Predicate[]

zero or more restriction predicates

Returns:Subquery<T>

the modified subquery

Annotations
@Override
isDistinctback to summary
public boolean isDistinct()

Implements javax.persistence.criteria.AbstractQuery.isDistinct.

Doc from javax.persistence.criteria.AbstractQuery.isDistinct.

Return whether duplicate query results must be eliminated or retained.

Returns:boolean

boolean indicating whether duplicate query results must be eliminated

Annotations
@Override
registerParametersback to summary
public void registerParameters(ParameterRegistry registry)

Implements org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Doc from org.hibernate.query.criteria.internal.ParameterContainer.registerParameters.

Register any parameters contained within this query component with the given registry.

Parameters
registry:ParameterRegistry

The parameter registry with which to register.

Annotations
@Override
renderback to summary
public String render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Doc from org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition

Annotations
@Override
selectback to summary
public Subquery<T> select(Expression<T> expression)

Implements javax.persistence.criteria.Subquery.select.

Doc from javax.persistence.criteria.Subquery.select.

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

Parameters
expression:Expression<T>

expression specifying the item that is to be returned as the subquery result

Returns:Subquery<T>

the modified subquery

Annotations
@Override
subqueryback to summary
public <U> Subquery<U> subquery(Class<U> subqueryType)

Implements javax.persistence.criteria.CommonAbstractCriteria.subquery.

Doc from javax.persistence.criteria.CommonAbstractCriteria.subquery.

Create a subquery of the query.

Parameters
subqueryType:Class<U>

the subquery result type

Returns:Subquery<U>

subquery

Annotations
@Override
whereback to summary
public Subquery<T> where(Expression<Boolean> expression)

Implements javax.persistence.criteria.Subquery.where.

Doc from javax.persistence.criteria.Subquery.where.

Modify the subquery to restrict the 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
expression:Expression<Boolean>

a simple or compound boolean expression

Returns:Subquery<T>

the modified subquery

Annotations
@Override
whereback to summary
public Subquery<T> where(Predicate... predicates)

Implements javax.persistence.criteria.Subquery.where.

Doc from javax.persistence.criteria.Subquery.where.

Modify the subquery to restrict the 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
predicates:Predicate[]

zero or more restriction predicates

Returns:Subquery<T>

the modified subquery

Annotations
@Override
org.hibernate.query.criteria.internal back to summary

public Class CriteriaSubqueryImpl.SubquerySelection<S>

extends DelegatedExpressionImpl<S>
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final CriteriaSubqueryImpl<T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition
Inherited from org.hibernate.query.criteria.internal.expression.DelegatedExpressionImpl:
aliasforceConversiongetAliasgetCompoundSelectionItemsgetJavaTypegetValueHandlergetValueHandlersgetWrappedisCompoundSelectionregisterParametersresetJavaTypesetAlias

Field Detail

subQueryback to summary
private final CriteriaSubqueryImpl<T> subQuery

Constructor Detail

SubquerySelectionback to summary
public SubquerySelection(ExpressionImpl<S> wrapped, CriteriaSubqueryImpl<T> subQuery)

Method Detail

renderback to summary
public String render(RenderingContext renderingContext)

Implements org.hibernate.query.criteria.internal.Renderable.render.

Doc from org.hibernate.query.criteria.internal.Renderable.render.

Perform the rendering, returning the rendition

Annotations
@Override