Top Methods
org.hibernate.query.criteria

public Interface JpaSubQuery<T>

extends Subquery<T>, JpaSelectCriteria<T>, JpaExpression<T>, JpaCteContainer
Known Direct Implementers
org.hibernate.query.sqm.tree.select.SqmSubQuery
Imports
java.util.List, jakarta.persistence.criteria.CollectionJoin, .Expression, .Join, .ListJoin, .MapJoin, .Order, .Predicate, .Root, .Selection, .SetJoin, .Subquery, org.hibernate.query.sqm.FetchClauseType

Author
Steve Ebersole

Method Summary

Modifier and TypeMethod and Description
public <X> JpaCrossJoin<X>
correlate(JpaCrossJoin<X> parentCrossJoin)

public <X> JpaEntityJoin<X>
correlate(JpaEntityJoin<X> parentEntityJoin)

public <Y> JpaRoot<Y>
correlate(Root<Y>
a root of the containing query
parentRoot
)

Redeclares jakarta.persistence.criteria.Subquery.correlate.

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

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

Redeclares jakarta.persistence.criteria.Subquery.distinct, org.hibernate.query.criteria.JpaSelectCriteria.distinct.

Specify whether duplicate query results will be eliminated.
public JpaSubQuery<T>
fetch(JpaExpression<? extends Number> fetch)

public JpaSubQuery<T>
fetch(JpaExpression<? extends Number> fetch, FetchClauseType fetchClauseType)

public JpaSubQuery<T>
fetch(Number fetch)

public JpaSubQuery<T>
fetch(Number fetch, FetchClauseType fetchClauseType)

public JpaExpression<Number>
public FetchClauseType
public JpaExpression<Number>
public List<JpaOrder>
public JpaExpression<T>
public JpaSubQuery<T>
groupBy(Expression<?>...
zero or more grouping expressions
grouping
)

Redeclares jakarta.persistence.criteria.Subquery.groupBy, org.hibernate.query.criteria.JpaSelectCriteria.groupBy.

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

Redeclares jakarta.persistence.criteria.Subquery.groupBy, org.hibernate.query.criteria.JpaSelectCriteria.groupBy.

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

Redeclares jakarta.persistence.criteria.Subquery.having, org.hibernate.query.criteria.JpaSelectCriteria.having.

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

Redeclares jakarta.persistence.criteria.Subquery.having, org.hibernate.query.criteria.JpaSelectCriteria.having.

Specify restrictions over the groups of the subquery according the conjunction of the specified restriction predicates.
public JpaSubQuery<T>
multiselect(Selection<?>... selections)

public JpaSubQuery<T>
multiselect(List<Selection<?>> selectionList)

public JpaSubQuery<T>
offset(JpaExpression<? extends Number> offset)

public JpaSubQuery<T>
offset(Number offset)

public JpaSubQuery<T>
orderBy(Order... o)

public JpaSubQuery<T>
public JpaSubQuery<T>
select(Expression<T>
expression specifying the item that is to be returned as the subquery result
expression
)

Redeclares jakarta.persistence.criteria.Subquery.select.

Specify the item that is to be returned as the subquery result.
public JpaSubQuery<T>
where(Expression<Boolean>
a simple or compound boolean expression
restriction
)

Redeclares jakarta.persistence.criteria.Subquery.where, org.hibernate.query.criteria.JpaSelectCriteria.where.

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

Redeclares jakarta.persistence.criteria.Subquery.where, org.hibernate.query.criteria.JpaSelectCriteria.where.

Modify the subquery to restrict the result according to the conjunction of the specified restriction predicates.
Inherited from jakarta.persistence.criteria.Subquery:
getContainingQuerygetCorrelatedJoinsgetParent
Inherited from org.hibernate.query.criteria.JpaCteContainer:
getCteCriteriagetCteCriteriaswithwithwithRecursiveUnionAllwithRecursiveUnionAllwithRecursiveUnionDistinctwithRecursiveUnionDistinct
Inherited from org.hibernate.query.criteria.JpaExpression:
asasBigDecimalasBigIntegerasDoubleasFloatasIntegerasLongasStringequalToequalToininininisNotNullisNull
Inherited from org.hibernate.query.criteria.JpaSelectCriteria:
fromfromfromfromgetGroupRestrictiongetQueryPartgetQuerySpecgetRestriction

Method Detail

correlateback to summary
public <X> JpaCrossJoin<X> correlate(JpaCrossJoin<X> parentCrossJoin)
correlateback to summary
public <X> JpaEntityJoin<X> correlate(JpaEntityJoin<X> parentEntityJoin)
correlateback to summary
public <Y> JpaRoot<Y> correlate(Root<Y> parentRoot)

Redeclares jakarta.persistence.criteria.Subquery.correlate.

Doc from jakarta.persistence.criteria.Subquery.correlate.

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

Parameters
parentRoot:Root<Y>

a root of the containing query

Returns:JpaRoot<Y>

subquery root

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

Doc from jakarta.persistence.criteria.Subquery.correlate.

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

Parameters
parentJoin:Join<X, Y>

join object of the containing query

Returns:JpaJoin<X, Y>

subquery join

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

Doc from jakarta.persistence.criteria.Subquery.correlate.

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

Parameters
parentCollection:CollectionJoin<X, Y>

join object of the containing query

Returns:JpaCollectionJoin<X, Y>

subquery join

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

Doc from jakarta.persistence.criteria.Subquery.correlate.

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

Parameters
parentSet:SetJoin<X, Y>

join object of the containing query

Returns:JpaSetJoin<X, Y>

subquery join

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

Doc from jakarta.persistence.criteria.Subquery.correlate.

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

Parameters
parentList:ListJoin<X, Y>

join object of the containing query

Returns:JpaListJoin<X, Y>

subquery join

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

Redeclares jakarta.persistence.criteria.Subquery.correlate.

Doc from jakarta.persistence.criteria.Subquery.correlate.

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

Parameters
parentMap:MapJoin<X, K, V>

join object of the containing query

Returns:JpaMapJoin<X, K, V>

subquery join

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

Redeclares jakarta.persistence.criteria.Subquery.distinct, org.hibernate.query.criteria.JpaSelectCriteria.distinct.

Doc from jakarta.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
distinct:boolean

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

Returns:JpaSubQuery<T>

the modified subquery.

Annotations
@Override
fetchback to summary
public JpaSubQuery<T> fetch(JpaExpression<? extends Number> fetch)
fetchback to summary
public JpaSubQuery<T> fetch(JpaExpression<? extends Number> fetch, FetchClauseType fetchClauseType)
fetchback to summary
public JpaSubQuery<T> fetch(Number fetch)
fetchback to summary
public JpaSubQuery<T> fetch(Number fetch, FetchClauseType fetchClauseType)
getFetchback to summary
public JpaExpression<Number> getFetch()
getFetchClauseTypeback to summary
public FetchClauseType getFetchClauseType()
getOffsetback to summary
public JpaExpression<Number> getOffset()
getOrderListback to summary
public List<JpaOrder> getOrderList()
getSelectionback to summary
public JpaExpression<T> getSelection()

Redeclares jakarta.persistence.criteria.Subquery.getSelection, org.hibernate.query.criteria.JpaSelectCriteria.getSelection.

Doc from jakarta.persistence.criteria.Subquery.getSelection.

Return the selection expression.

Returns:JpaExpression<T>

the item to be returned in the subquery result

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

Redeclares jakarta.persistence.criteria.Subquery.groupBy, org.hibernate.query.criteria.JpaSelectCriteria.groupBy.

Doc from jakarta.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
grouping:Expression<?>[]

zero or more grouping expressions

Returns:JpaSubQuery<T>

the modified subquery

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

Redeclares jakarta.persistence.criteria.Subquery.groupBy, org.hibernate.query.criteria.JpaSelectCriteria.groupBy.

Doc from jakarta.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
grouping:List<Expression<?>>

list of zero or more grouping expressions

Returns:JpaSubQuery<T>

the modified subquery

Annotations
@Override
havingback to summary
public JpaSubQuery<T> having(Expression<Boolean> restriction)

Redeclares jakarta.persistence.criteria.Subquery.having, org.hibernate.query.criteria.JpaSelectCriteria.having.

Doc from jakarta.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
restriction:Expression<Boolean>

a simple or compound boolean expression

Returns:JpaSubQuery<T>

the modified subquery

Annotations
@Override
havingback to summary
public JpaSubQuery<T> having(Predicate... restrictions)

Redeclares jakarta.persistence.criteria.Subquery.having, org.hibernate.query.criteria.JpaSelectCriteria.having.

Doc from jakarta.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
restrictions:Predicate[]

zero or more restriction predicates

Returns:JpaSubQuery<T>

the modified subquery

Annotations
@Override
multiselectback to summary
public JpaSubQuery<T> multiselect(Selection<?>... selections)
multiselectback to summary
public JpaSubQuery<T> multiselect(List<Selection<?>> selectionList)
offsetback to summary
public JpaSubQuery<T> offset(JpaExpression<? extends Number> offset)
offsetback to summary
public JpaSubQuery<T> offset(Number offset)
orderByback to summary
public JpaSubQuery<T> orderBy(Order... o)
orderByback to summary
public JpaSubQuery<T> orderBy(List<Order> o)
selectback to summary
public JpaSubQuery<T> select(Expression<T> expression)

Redeclares jakarta.persistence.criteria.Subquery.select.

Doc from jakarta.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:JpaSubQuery<T>

the modified subquery

Annotations
@Override
whereback to summary
public JpaSubQuery<T> where(Expression<Boolean> restriction)

Redeclares jakarta.persistence.criteria.Subquery.where, org.hibernate.query.criteria.JpaSelectCriteria.where.

Doc from jakarta.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
restriction:Expression<Boolean>

a simple or compound boolean expression

Returns:JpaSubQuery<T>

the modified subquery

Annotations
@Override
whereback to summary
public JpaSubQuery<T> where(Predicate... restrictions)

Redeclares jakarta.persistence.criteria.Subquery.where, org.hibernate.query.criteria.JpaSelectCriteria.where.

Doc from jakarta.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
restrictions:Predicate[]

zero or more restriction predicates

Returns:JpaSubQuery<T>

the modified subquery

Annotations
@Override