Class SqmSubQuery<T>
java.lang.Object
org.hibernate.query.sqm.tree.AbstractSqmNode
org.hibernate.query.sqm.tree.select.AbstractSqmSelectQuery<T>
org.hibernate.query.sqm.tree.select.SqmSubQuery<T>
- All Implemented Interfaces:
AbstractQuery<T>,CommonAbstractCriteria,Expression<T>,Selection<T>,Subquery<T>,TupleElement<T>,Serializable,JpaCriteriaBase,JpaCriteriaNode,JpaCteContainer,JpaExpression<T>,JpaSelectCriteria<T>,JpaSelection<T>,JpaSubQuery<T>,JpaTupleElement<T>,SqmCteContainer,SqmExpression<T>,SqmSelectableNode<T>,SqmSelectQuery<T>,SqmExpressibleAccessor<T>,SqmNode,SqmQuery<T>,SqmTypedNode<T>,SqmVisitableNode
public class SqmSubQuery<T>
extends AbstractSqmSelectQuery<T>
implements SqmSelectQuery<T>, JpaSubQuery<T>, SqmExpression<T>
- Author:
- Steve Ebersole
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionSqmSubQuery(SqmQuery<?> parent, Class<T> resultType, NodeBuilder builder) SqmSubQuery(SqmQuery<?> parent, NodeBuilder builder) SqmSubQuery(SqmQuery<?> parent, SqmQueryPart<T> queryPart, Class<T> resultType, Map<String, SqmCteStatement<?>> cteStatements, NodeBuilder builder) SqmSubQuery(SqmQuery<?> parent, SqmQueryPart<T> queryPart, Class<T> resultType, NodeBuilder builder) -
Method Summary
Modifier and TypeMethodDescription<T1> T1accept(SemanticQueryWalker<T1> walker) Accept the walker per visitationAssigns an alias to the selection item.voidvoidapplyInferableType(@Nullable SqmExpressible<?> type) Used to apply type information based on the expression's usage within the query.<X> SqmExpression<X>Perform a typecast upon the expression, returning a new expression object.asDouble()asFloat()asLong()asString()copy(SqmCopyContext context) <X,Y> SqmBagJoin<X, Y> correlate(CollectionJoin<X, Y> parentCollection) Create a subquery collection join object correlated to a collection join object of the enclosing query.<X,Y> SqmAttributeJoin<X, Y> Create a subquery join object correlated to a join object of the enclosing query.<X,Y> SqmListJoin<X, Y> Create a subquery list join object correlated to a list join object of the enclosing query.<X,K, V> SqmMapJoin<X, K, V> Create a subquery map join object correlated to a map join object of the enclosing query.<Y> SqmRoot<Y>Create a subquery root correlated to a root of the enclosing query.<X,Y> SqmSetJoin<X, Y> Create a subquery set join object correlated to a set join object of the enclosing query.<X> SqmCrossJoin<X>correlate(JpaCrossJoin<X> parentCrossJoin) <X> SqmEntityJoin<X>correlate(JpaEntityJoin<X> parentEntityJoin) distinct(boolean distinct) Specify whether duplicate query results will be eliminated.equalTo(Expression<T> that) fetch(Number fetch, FetchClauseType fetchClauseType) fetch(JpaExpression<? extends Number> fetch) fetch(JpaExpression<? extends Number> fetch, FetchClauseType fetchClauseType) getAlias()Return the alias assigned to the tuple element or null, if no alias has been assigned.Return the selection items composing a compound selection.SqmQuery<?>Return the query of which this is a subquery.Return the correlated joins of the subquery.<X> JpaCteCriteria<X>getCteCriteria(String cteName) Returns a CTE that is registered by the given name on this container, or any of its parents.getCteStatement(String cteLabel) getFetch()Return the Java type of the tuple element.@Nullable SqmExpressible<T>The expression's type.Return the query of which this is a subquery.Return the selection of the query, or null if no selection has been set.List<? extends JpaSelection<?>>groupBy(Expression<?>... expressions) 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> booleanExpression) 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) Create a predicate to test whether the expression is a member of the argument list.in(Expression<Collection<?>> values) Create a predicate to test whether the expression is a member of the collection.Create a predicate to test whether the expression is a member of the argument list.in(Collection<?> values) Create a predicate to test whether the expression is a member of the collection.booleanWhether the selection item is a compound selection.Create a predicate to test whether the expression is not null.isNull()Create a predicate to test whether the expression is null.multiselect(Selection<?>... selections) multiselect(List<Selection<?>> selectionList) offset(JpaExpression<? extends Number> offset) select(Expression<T> expression) Specify the item that is to be returned as the subquery result.<U> SqmSubQuery<U>Create a subquery of the query.where(Expression<Boolean> restriction) Modify the query to restrict the query results according to the specified boolean expression.Modify the query to restrict the query results according to the conjunction of the specified restriction predicates.Methods inherited from class org.hibernate.query.sqm.tree.select.AbstractSqmSelectQuery
copyCteStatements, from, from, from, from, getCteCriterias, getCteStatements, getGroupList, getGroupRestriction, getQueryPart, getQuerySpec, getRestriction, getResultSelection, getResultType, getRootList, getRoots, isDistinct, setQueryPart, setResultType, with, with, withRecursiveUnionAll, withRecursiveUnionAll, withRecursiveUnionDistinct, withRecursiveUnionDistinctMethods inherited from class org.hibernate.query.sqm.tree.AbstractSqmNode
nodeBuilderMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface jakarta.persistence.criteria.AbstractQuery
getGroupList, getResultType, getRoots, isDistinctMethods inherited from interface org.hibernate.query.criteria.JpaCteContainer
getCteCriterias, with, with, withRecursiveUnionAll, withRecursiveUnionAll, withRecursiveUnionDistinct, withRecursiveUnionDistinctMethods inherited from interface org.hibernate.query.criteria.JpaSelectCriteria
from, from, from, from, getGroupRestriction, getRestrictionMethods inherited from interface org.hibernate.query.criteria.JpaTupleElement
getJavaTypeName, isEnumMethods inherited from interface org.hibernate.query.sqm.tree.cte.SqmCteContainer
getCteStatementsMethods inherited from interface org.hibernate.query.sqm.tree.expression.SqmExpression
cast, castAs, visitSubSelectableNodesMethods inherited from interface org.hibernate.query.sqm.tree.SqmNode
nodeBuilderMethods inherited from interface org.hibernate.query.sqm.tree.select.SqmSelectQuery
getQueryPart, getQuerySpecMethods inherited from interface org.hibernate.query.sqm.tree.SqmTypedNode
getExpressible, getNodeJavaTypeMethods inherited from interface org.hibernate.query.sqm.tree.SqmVisitableNode
toHqlString
-
Constructor Details
-
SqmSubQuery
public SqmSubQuery(SqmQuery<?> parent, SqmQueryPart<T> queryPart, Class<T> resultType, NodeBuilder builder) -
SqmSubQuery
public SqmSubQuery(SqmQuery<?> parent, SqmQueryPart<T> queryPart, Class<T> resultType, Map<String, SqmCteStatement<?>> cteStatements, NodeBuilder builder) -
SqmSubQuery
-
SqmSubQuery
-
-
Method Details
-
copy
- Specified by:
copyin interfaceSqmExpression<T>- Specified by:
copyin interfaceSqmNode- Specified by:
copyin interfaceSqmQuery<T>- Specified by:
copyin interfaceSqmSelectableNode<T>- Specified by:
copyin interfaceSqmSelectQuery<T>- Specified by:
copyin interfaceSqmTypedNode<T>
-
getTupleLength
- Specified by:
getTupleLengthin interfaceSqmSelectableNode<T>
-
getCteStatement
- Specified by:
getCteStatementin interfaceSqmCteContainer- Overrides:
getCteStatementin classAbstractSqmSelectQuery<T>
-
getCteCriteria
Description copied from interface:JpaCteContainerReturns a CTE that is registered by the given name on this container, or any of its parents.- Specified by:
getCteCriteriain interfaceJpaCteContainer- Overrides:
getCteCriteriain classAbstractSqmSelectQuery<T>
-
getContainingQuery
Description copied from interface:SubqueryReturn the query of which this is a subquery. This may be a CriteriaQuery, CriteriaUpdate, CriteriaDelete, or a Subquery.- Specified by:
getContainingQueryin interfaceSubquery<T>- Returns:
- the enclosing query or subquery
-
getParent
Description copied from interface:SubqueryReturn the query of which this is a subquery. This must be a CriteriaQuery or a Subquery. -
getAlias
Description copied from interface:TupleElementReturn the alias assigned to the tuple element or null, if no alias has been assigned.- Specified by:
getAliasin interfaceTupleElement<T>- Returns:
- alias
-
alias
Description copied from interface:SelectionAssigns an alias to the selection item. Once assigned, an alias cannot be changed or reassigned. Returns the same selection item. -
select
Description copied from interface:SubquerySpecify the item that is to be returned as the subquery result. Replaces the previously specified selection, if any. -
multiselect
- Specified by:
multiselectin interfaceJpaSubQuery<T>
-
multiselect
- Specified by:
multiselectin interfaceJpaSubQuery<T>
-
getSelection
Description copied from interface:AbstractQueryReturn the selection of the query, or null if no selection has been set.- Specified by:
getSelectionin interfaceAbstractQuery<T>- Specified by:
getSelectionin interfaceJpaSelectCriteria<T>- Specified by:
getSelectionin interfaceJpaSubQuery<T>- Specified by:
getSelectionin interfaceSubquery<T>- Overrides:
getSelectionin classAbstractSqmSelectQuery<T>- Returns:
- selection item
-
isCompoundSelection
public boolean isCompoundSelection()Description copied from interface:SelectionWhether the selection item is a compound selection.- Specified by:
isCompoundSelectionin interfaceSelection<T>- Returns:
- boolean indicating whether the selection is a compound selection
-
getSelectionItems
- Specified by:
getSelectionItemsin interfaceJpaSelection<T>
-
getCompoundSelectionItems
Description copied from interface:SelectionReturn the selection items composing a compound selection. Modifications to the list do not affect the query.- Specified by:
getCompoundSelectionItemsin interfaceJpaSelection<T>- Specified by:
getCompoundSelectionItemsin interfaceSelection<T>- Returns:
- list of selection items
-
distinct
Description copied from interface:AbstractQuerySpecify 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.- Specified by:
distinctin interfaceAbstractQuery<T>- Specified by:
distinctin interfaceJpaSelectCriteria<T>- Specified by:
distinctin interfaceJpaSubQuery<T>- Specified by:
distinctin interfaceSqmSelectQuery<T>- Specified by:
distinctin interfaceSubquery<T>- Overrides:
distinctin classAbstractSqmSelectQuery<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
-
where
Description copied from interface:AbstractQueryModify the query to restrict the query results according to the specified boolean expression. Replaces the previously added restriction(s), if any.- Specified by:
wherein interfaceAbstractQuery<T>- Specified by:
wherein interfaceJpaSelectCriteria<T>- Specified by:
wherein interfaceJpaSubQuery<T>- Specified by:
wherein interfaceSubquery<T>- Overrides:
wherein classAbstractSqmSelectQuery<T>- Parameters:
restriction- a simple or compound boolean expression- Returns:
- the modified query
-
where
Description copied from interface:AbstractQueryModify the query to restrict the query results 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.- Specified by:
wherein interfaceAbstractQuery<T>- Specified by:
wherein interfaceJpaSelectCriteria<T>- Specified by:
wherein interfaceJpaSubQuery<T>- Specified by:
wherein interfaceSubquery<T>- Overrides:
wherein classAbstractSqmSelectQuery<T>- Parameters:
restrictions- zero or more restriction predicates- Returns:
- the modified query
-
groupBy
Description copied from interface:AbstractQuerySpecify 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 interfaceAbstractQuery<T>- Specified by:
groupByin interfaceJpaSelectCriteria<T>- Specified by:
groupByin interfaceJpaSubQuery<T>- Specified by:
groupByin interfaceSubquery<T>- Overrides:
groupByin classAbstractSqmSelectQuery<T>- Parameters:
expressions- zero or more grouping expressions- Returns:
- the modified query
-
groupBy
Description copied from interface:AbstractQuerySpecify 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 interfaceAbstractQuery<T>- Specified by:
groupByin interfaceJpaSelectCriteria<T>- Specified by:
groupByin interfaceJpaSubQuery<T>- Specified by:
groupByin interfaceSubquery<T>- Overrides:
groupByin classAbstractSqmSelectQuery<T>- Parameters:
grouping- list of zero or more grouping expressions- Returns:
- the modified query
-
having
Description copied from interface:AbstractQuerySpecify a restriction over the groups of the query. Replaces the previous having restriction(s), if any.- Specified by:
havingin interfaceAbstractQuery<T>- Specified by:
havingin interfaceJpaSelectCriteria<T>- Specified by:
havingin interfaceJpaSubQuery<T>- Specified by:
havingin interfaceSubquery<T>- Overrides:
havingin classAbstractSqmSelectQuery<T>- Parameters:
booleanExpression- a simple or compound boolean expression- Returns:
- the modified query
-
having
Description copied from interface:AbstractQuerySpecify restrictions over the groups of the query according the conjunction of the specified restriction predicates. Replaces the previously having added restriction(s), if any. If no restrictions are specified, any previously added restrictions are simply removed.- Specified by:
havingin interfaceAbstractQuery<T>- Specified by:
havingin interfaceJpaSelectCriteria<T>- Specified by:
havingin interfaceJpaSubQuery<T>- Specified by:
havingin interfaceSubquery<T>- Overrides:
havingin classAbstractSqmSelectQuery<T>- Parameters:
predicates- zero or more restriction predicates- Returns:
- the modified query
-
getOffset
- Specified by:
getOffsetin interfaceJpaSubQuery<T>
-
offset
- Specified by:
offsetin interfaceJpaSubQuery<T>
-
offset
- Specified by:
offsetin interfaceJpaSubQuery<T>
-
getFetch
- Specified by:
getFetchin interfaceJpaSubQuery<T>
-
fetch
- Specified by:
fetchin interfaceJpaSubQuery<T>
-
fetch
- Specified by:
fetchin interfaceJpaSubQuery<T>
-
fetch
- Specified by:
fetchin interfaceJpaSubQuery<T>
-
fetch
- Specified by:
fetchin interfaceJpaSubQuery<T>
-
getFetchClauseType
- Specified by:
getFetchClauseTypein interfaceJpaSubQuery<T>
-
getOrderList
- Specified by:
getOrderListin interfaceJpaSubQuery<T>
-
orderBy
- Specified by:
orderByin interfaceJpaSubQuery<T>
-
orderBy
- Specified by:
orderByin interfaceJpaSubQuery<T>
-
correlate
Description copied from interface:SubqueryCreate a subquery root correlated to a root of the enclosing query. -
correlate
Description copied from interface:SubqueryCreate a subquery join object correlated to a join object of the enclosing query. -
correlate
Description copied from interface:SubqueryCreate a subquery collection join object correlated to a collection join object of the enclosing query. -
correlate
Description copied from interface:SubqueryCreate a subquery set join object correlated to a set join object of the enclosing query. -
correlate
Description copied from interface:SubqueryCreate a subquery list join object correlated to a list join object of the enclosing query. -
correlate
Description copied from interface:SubqueryCreate a subquery map join object correlated to a map join object of the enclosing query. -
correlate
- Specified by:
correlatein interfaceJpaSubQuery<T>
-
correlate
- Specified by:
correlatein interfaceJpaSubQuery<T>
-
isNull
Description copied from interface:ExpressionCreate a predicate to test whether the expression is null.- Specified by:
isNullin interfaceExpression<T>- Specified by:
isNullin interfaceJpaExpression<T>- Specified by:
isNullin interfaceSqmExpression<T>- Returns:
- predicate testing whether the expression is null
-
isNotNull
Description copied from interface:ExpressionCreate a predicate to test whether the expression is not null.- Specified by:
isNotNullin interfaceExpression<T>- Specified by:
isNotNullin interfaceJpaExpression<T>- Specified by:
isNotNullin interfaceSqmExpression<T>- Returns:
- predicate testing whether the expression is not null
-
equalTo
- Specified by:
equalToin interfaceJpaExpression<T>- Specified by:
equalToin interfaceSqmExpression<T>
-
equalTo
- Specified by:
equalToin interfaceJpaExpression<T>- Specified by:
equalToin interfaceSqmExpression<T>
-
in
Description copied from interface:ExpressionCreate a predicate to test whether the expression is a member of the argument list.- Specified by:
inin interfaceExpression<T>- Specified by:
inin interfaceJpaExpression<T>- Specified by:
inin interfaceSqmExpression<T>- Parameters:
values- values to be tested against- Returns:
- predicate testing for membership
-
in
Description copied from interface:ExpressionCreate a predicate to test whether the expression is a member of the argument list.- Specified by:
inin interfaceExpression<T>- Specified by:
inin interfaceJpaExpression<T>- Specified by:
inin interfaceSqmExpression<T>- Parameters:
values- expressions to be tested against- Returns:
- predicate testing for membership
-
in
Description copied from interface:ExpressionCreate a predicate to test whether the expression is a member of the collection.- Specified by:
inin interfaceExpression<T>- Specified by:
inin interfaceJpaExpression<T>- Specified by:
inin interfaceSqmExpression<T>- Parameters:
values- collection of values to be tested against- Returns:
- predicate testing for membership
-
in
Description copied from interface:ExpressionCreate a predicate to test whether the expression is a member of the collection.- Specified by:
inin interfaceExpression<T>- Specified by:
inin interfaceJpaExpression<T>- Specified by:
inin interfaceSqmExpression<T>- Parameters:
values- expression corresponding to collection to be tested against- Returns:
- predicate testing for membership
-
getNodeType
Description copied from interface:SqmExpressionThe expression's type.Can change as a result of calls to
SqmExpression.applyInferableType(org.hibernate.query.sqm.SqmExpressible<?>)- Specified by:
getNodeTypein interfaceSqmExpression<T>- Specified by:
getNodeTypein interfaceSqmTypedNode<T>
-
applyInferableType
Description copied from interface:SqmExpressionUsed to apply type information based on the expression's usage within the query.- Specified by:
applyInferableTypein interfaceSqmExpression<T>
-
asLong
- Specified by:
asLongin interfaceJpaExpression<T>- Specified by:
asLongin interfaceSqmExpression<T>
-
asInteger
- Specified by:
asIntegerin interfaceJpaExpression<T>- Specified by:
asIntegerin interfaceSqmExpression<T>
-
asFloat
- Specified by:
asFloatin interfaceJpaExpression<T>- Specified by:
asFloatin interfaceSqmExpression<T>
-
asDouble
- Specified by:
asDoublein interfaceJpaExpression<T>- Specified by:
asDoublein interfaceSqmExpression<T>
-
asBigDecimal
- Specified by:
asBigDecimalin interfaceJpaExpression<T>- Specified by:
asBigDecimalin interfaceSqmExpression<T>
-
asBigInteger
- Specified by:
asBigIntegerin interfaceJpaExpression<T>- Specified by:
asBigIntegerin interfaceSqmExpression<T>
-
asString
- Specified by:
asStringin interfaceJpaExpression<T>- Specified by:
asStringin interfaceSqmExpression<T>
-
as
Description copied from interface:ExpressionPerform a typecast upon the expression, returning a new expression object. This method does not cause type conversion: the runtime type is not changed. Warning: may result in a runtime failure.- Specified by:
asin interfaceExpression<T>- Specified by:
asin interfaceJpaExpression<T>- Specified by:
asin interfaceSqmExpression<T>- Parameters:
type- intended type of the expression- Returns:
- new expression of the given type
-
getJavaTypeDescriptor
- Specified by:
getJavaTypeDescriptorin interfaceJpaTupleElement<T>
-
getJavaType
Description copied from interface:TupleElementReturn the Java type of the tuple element.- Specified by:
getJavaTypein interfaceJpaTupleElement<T>- Specified by:
getJavaTypein interfaceTupleElement<T>- Returns:
- the Java type of the tuple element
-
subquery
Description copied from interface:CommonAbstractCriteriaCreate a subquery of the query.- Specified by:
subqueryin interfaceCommonAbstractCriteria- Specified by:
subqueryin interfaceJpaCriteriaBase- Parameters:
type- the subquery result type- Returns:
- subquery
-
asLoggableText
- Specified by:
asLoggableTextin interfaceSqmNode
-
accept
Description copied from interface:SqmVisitableNodeAccept the walker per visitation- Specified by:
acceptin interfaceSqmVisitableNode
-
appendHqlString
- Specified by:
appendHqlStringin interfaceSqmVisitableNode- Overrides:
appendHqlStringin classAbstractSqmSelectQuery<T>
-