Class AbstractSqmSelectQuery<T>
java.lang.Object
org.hibernate.query.sqm.tree.spi.AbstractSqmNode
org.hibernate.query.sqm.tree.spi.select.AbstractSqmSelectQuery<T>
- All Implemented Interfaces:
AbstractQuery<T>, CommonAbstractCriteria, Serializable, JpaCriteriaBase, JpaCriteriaNode, JpaCteContainer, JpaSelectCriteria<T>, SqmCteContainer, SqmSelectQuery<T>, SqmCacheable, SqmNode, SqmQuery<T>
- Direct Known Subclasses:
SqmSelectStatement, SqmSubQuery
public abstract class AbstractSqmSelectQuery<T>
extends AbstractSqmNode
implements SqmSelectQuery<T>
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorsModifierConstructorDescriptionAbstractSqmSelectQuery(Class<T> resultType, NodeBuilder builder) protectedAbstractSqmSelectQuery(NodeBuilder builder, Map<String, SqmCteStatement<?>> cteStatements, Class<T> resultType) AbstractSqmSelectQuery(SqmQueryPart<T> queryPart, Class<T> resultType, NodeBuilder builder) AbstractSqmSelectQuery(SqmQueryPart<T> queryPart, Map<String, SqmCteStatement<?>> cteStatements, Class<T> resultType, NodeBuilder builder) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendHqlString(StringBuilder hql, SqmRenderContext context) intprotected Map<String, SqmCteStatement<?>> copyCteStatements(SqmCopyContext context) distinct(boolean distinct) Set whether duplicate query results are eliminated.boolean<X> SqmDerivedRoot<X> Create and add a query root corresponding to the given subquery, forming a cartesian product with any existing roots.<X> SqmRoot<X> from(EntityType<X> entityType) Create a query root for the given entity type.<X> SqmRoot<X> Create a query root for the given entity type.<X> JpaRoot<X> from(JpaCteCriteria<X> cte) Create and add a query root corresponding to the given cte, forming a cartesian product with any existing roots.<X> JpaFunctionRoot<X> from(JpaSetReturningFunction<X> function) Create and add a query root corresponding to the given set-returning function, forming a cartesian product with any existing roots.<X> JpaCteCriteria<X> getCteCriteria(String cteName) Returns a CTE that is registered by the given name on this container, or any of its parents.Collection<? extends JpaCteCriteria<?>> Returns the CTEs that are registered on this container.getCteStatement(String cteLabel) List<Expression<?>> Return the group restriction.The query structure.The query structure.Return the restriction predicate.getResultSelection(Selection<?>[] selections) <E> JpaRoot<? extends E> <E> JpaRoot<? extends E> getRoots()Return the query selection.groupBy(Expression<?>... expressions) Set the grouping expressions.groupBy(List<Expression<?>> grouping) Set the grouping expressions.inthashCode()having(BooleanExpression... restrictions) Set the group restriction.having(Expression<Boolean> booleanExpression) Set the group restriction.having(List<? extends Expression<Boolean>> restrictions) Set the group restriction.booleanisCompatible(Object object) booleanvoidsetQueryPart(SqmQueryPart<T> sqmQueryPart) where(BooleanExpression... restrictions) Set the restriction.where(Expression<Boolean> restriction) Set the restriction.where(List<? extends Expression<Boolean>> restrictions) Set the restriction.<X> JpaCteCriteria<X> with(AbstractQuery<X> criteria) Deprecated.<X> JpaCteCriteria<X> with(String name, AbstractQuery<X> criteria) LikeJpaCteContainer.with(AbstractQuery)but assigns an explicit CTE name.protected <X> JpaCteCriteria<X> withInternal(String name, AbstractQuery<X> criteria) protected <X> JpaCteCriteria<X> withInternal(String name, AbstractQuery<X> baseCriteria, boolean unionDistinct, Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) <X> JpaCteCriteria<X> withRecursiveUnionAll(AbstractQuery<X> baseCriteria, Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) Allows to register a recursive CTE.<X> JpaCteCriteria<X> withRecursiveUnionAll(String name, AbstractQuery<X> baseCriteria, Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) LikeJpaCteContainer.withRecursiveUnionAll(AbstractQuery, Function)but assigns an explicit CTE name.<X> JpaCteCriteria<X> withRecursiveUnionDistinct(AbstractQuery<X> baseCriteria, Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) Allows to register a recursive CTE.<X> JpaCteCriteria<X> withRecursiveUnionDistinct(String name, AbstractQuery<X> baseCriteria, Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) LikeJpaCteContainer.withRecursiveUnionDistinct(AbstractQuery, Function)but assigns an explicit CTE name.Methods inherited from class AbstractSqmNode
nodeBuilderMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface CommonAbstractCriteria
getParameters, subqueryMethods inherited from interface JpaCriteriaBase
subqueryMethods inherited from interface SqmNode
asLoggableText, nodeBuilderMethods inherited from interface SqmQuery
generateAliasMethods inherited from interface SqmSelectQuery
copy
-
Constructor Details
-
AbstractSqmSelectQuery
-
AbstractSqmSelectQuery
public AbstractSqmSelectQuery(@Nonnull SqmQueryPart<T> queryPart, @Nonnull Class<T> resultType, @Nonnull NodeBuilder builder) -
AbstractSqmSelectQuery
protected AbstractSqmSelectQuery(@Nonnull NodeBuilder builder, @Nonnull Map<String, SqmCteStatement<?>> cteStatements, @Nonnull Class<T> resultType) -
AbstractSqmSelectQuery
public AbstractSqmSelectQuery(@Nonnull SqmQueryPart<T> queryPart, @Nonnull Map<String, SqmCteStatement<?>> cteStatements, @Nonnull Class<T> resultType, @Nonnull NodeBuilder builder)
-
-
Method Details
-
copyCteStatements
@Nonnull protected Map<String, SqmCteStatement<?>> copyCteStatements(@Nonnull SqmCopyContext context) -
getCteStatements
- Specified by:
getCteStatementsin interfaceSqmCteContainer
-
getCteStatement
- Specified by:
getCteStatementin interfaceSqmCteContainer
-
getCteCriterias
Description copied from interface:JpaCteContainerReturns the CTEs that are registered on this container.- Specified by:
getCteCriteriasin interfaceJpaCteContainer
-
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
-
with
Deprecated.Description copied from interface:JpaCteContainerRegisters the givenCriteriaQueryand returns aJpaCteCriteria, which can be used for querying.- Specified by:
within interfaceJpaCteContainer- See Also:
-
withRecursiveUnionAll
@Nonnull public <X> JpaCteCriteria<X> withRecursiveUnionAll(@Nonnull AbstractQuery<X> baseCriteria, @Nonnull Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerAllows to register a recursive CTE. The baseCriteriaQueryserves for the structure of theJpaCteCriteria, which is made available in the recursive criteria producer function, so that the recursiveCriteriaQueryis able to refer to the CTE again.- Specified by:
withRecursiveUnionAllin interfaceJpaCteContainer- See Also:
-
withRecursiveUnionDistinct
@Nonnull public <X> JpaCteCriteria<X> withRecursiveUnionDistinct(@Nonnull AbstractQuery<X> baseCriteria, @Nonnull Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerAllows to register a recursive CTE. The baseCriteriaQueryserves for the structure of theJpaCteCriteria, which is made available in the recursive criteria producer function, so that the recursiveCriteriaQueryis able to refer to the CTE again.- Specified by:
withRecursiveUnionDistinctin interfaceJpaCteContainer- See Also:
-
with
@Nonnull public <X> JpaCteCriteria<X> with(@Nonnull String name, @Nonnull AbstractQuery<X> criteria) Description copied from interface:JpaCteContainerLikeJpaCteContainer.with(AbstractQuery)but assigns an explicit CTE name.- Specified by:
within interfaceJpaCteContainer
-
withRecursiveUnionAll
@Nonnull public <X> JpaCteCriteria<X> withRecursiveUnionAll(@Nonnull String name, @Nonnull AbstractQuery<X> baseCriteria, @Nonnull Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerLikeJpaCteContainer.withRecursiveUnionAll(AbstractQuery, Function)but assigns an explicit CTE name.- Specified by:
withRecursiveUnionAllin interfaceJpaCteContainer
-
withRecursiveUnionDistinct
@Nonnull public <X> JpaCteCriteria<X> withRecursiveUnionDistinct(@Nonnull String name, @Nonnull AbstractQuery<X> baseCriteria, @Nonnull Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) Description copied from interface:JpaCteContainerLikeJpaCteContainer.withRecursiveUnionDistinct(AbstractQuery, Function)but assigns an explicit CTE name.- Specified by:
withRecursiveUnionDistinctin interfaceJpaCteContainer
-
withInternal
@Nonnull protected <X> JpaCteCriteria<X> withInternal(@Nonnull String name, @Nonnull AbstractQuery<X> criteria) -
withInternal
@Nonnull protected <X> JpaCteCriteria<X> withInternal(@Nonnull String name, @Nonnull AbstractQuery<X> baseCriteria, boolean unionDistinct, @Nonnull Function<JpaCteCriteria<X>, AbstractQuery<X>> recursiveCriteriaProducer) -
getResultType
- Specified by:
getResultTypein interfaceAbstractQuery<T>
-
getQuerySpec
Description copied from interface:JpaSelectCriteriaThe query structure. SeeJpaQueryStructurefor details- Specified by:
getQuerySpecin interfaceJpaSelectCriteria<T>- Specified by:
getQuerySpecin interfaceSqmSelectQuery<T>
-
getQueryPart
Description copied from interface:JpaSelectCriteriaThe query structure. SeeJpaQueryStructurefor details- Specified by:
getQueryPartin interfaceJpaSelectCriteria<T>- Specified by:
getQueryPartin interfaceSqmSelectQuery<T>
-
setQueryPart
-
getRoots
-
getRootList
- Specified by:
getRootListin interfaceAbstractQuery<T>- See Also:
-
getRoot
-
getRoot
-
from
Description copied from interface:JpaSelectCriteriaCreate a query root for the given entity type.- Specified by:
fromin interfaceAbstractQuery<T>- Specified by:
fromin interfaceJpaSelectCriteria<T>
-
from
Description copied from interface:JpaSelectCriteriaCreate and add a query root corresponding to the given subquery, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceJpaSelectCriteria<T>- Parameters:
subquery- the subquery- Returns:
- query root corresponding to the given subquery
-
from
Description copied from interface:JpaSelectCriteriaCreate and add a query root corresponding to the given cte, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceJpaSelectCriteria<T>- Parameters:
cte- the cte criteria- Returns:
- query root corresponding to the given cte
-
from
Description copied from interface:JpaSelectCriteriaCreate and add a query root corresponding to the given set-returning function, forming a cartesian product with any existing roots.- Specified by:
fromin interfaceJpaSelectCriteria<T>- Parameters:
function- the set-returning function- Returns:
- query root corresponding to the given function
-
from
Description copied from interface:JpaSelectCriteriaCreate a query root for the given entity type.- Specified by:
fromin interfaceAbstractQuery<T>- Specified by:
fromin interfaceJpaSelectCriteria<T>
-
isDistinct
public boolean isDistinct()- Specified by:
isDistinctin interfaceAbstractQuery<T>
-
distinct
Description copied from interface:JpaSelectCriteriaSet whether duplicate query results are eliminated.- Specified by:
distinctin interfaceAbstractQuery<T>- Specified by:
distinctin interfaceJpaSelectCriteria<T>- Specified by:
distinctin interfaceSqmSelectQuery<T>
-
getSelection
Description copied from interface:JpaSelectCriteriaReturn the query selection.- Specified by:
getSelectionin interfaceAbstractQuery<T>- Specified by:
getSelectionin interfaceJpaSelectCriteria<T>
-
getRestriction
Description copied from interface:JpaCriteriaBaseReturn the restriction predicate.- Specified by:
getRestrictionin interfaceCommonAbstractCriteria- Specified by:
getRestrictionin interfaceJpaCriteriaBase- Specified by:
getRestrictionin interfaceJpaSelectCriteria<T>
-
where
Description copied from interface:JpaSelectCriteriaSet the restriction.- Specified by:
wherein interfaceAbstractQuery<T>- Specified by:
wherein interfaceJpaSelectCriteria<T>
-
where
Description copied from interface:JpaSelectCriteriaSet the restriction.- Specified by:
wherein interfaceAbstractQuery<T>- Specified by:
wherein interfaceJpaSelectCriteria<T>
-
where
@Nonnull public JpaSelectCriteria<T> where(@Nonnull List<? extends Expression<Boolean>> restrictions) Description copied from interface:JpaSelectCriteriaSet the restriction.- Specified by:
wherein interfaceAbstractQuery<T>- Specified by:
wherein interfaceJpaSelectCriteria<T>
-
getGroupList
- Specified by:
getGroupListin interfaceAbstractQuery<T>
-
groupBy
Description copied from interface:JpaSelectCriteriaSet the grouping expressions.- Specified by:
groupByin interfaceAbstractQuery<T>- Specified by:
groupByin interfaceJpaSelectCriteria<T>
-
groupBy
Description copied from interface:JpaSelectCriteriaSet the grouping expressions.- Specified by:
groupByin interfaceAbstractQuery<T>- Specified by:
groupByin interfaceJpaSelectCriteria<T>
-
getGroupRestriction
Description copied from interface:JpaSelectCriteriaReturn the group restriction.- Specified by:
getGroupRestrictionin interfaceAbstractQuery<T>- Specified by:
getGroupRestrictionin interfaceJpaSelectCriteria<T>
-
having
Description copied from interface:JpaSelectCriteriaSet the group restriction.- Specified by:
havingin interfaceAbstractQuery<T>- Specified by:
havingin interfaceJpaSelectCriteria<T>
-
having
Description copied from interface:JpaSelectCriteriaSet the group restriction.- Specified by:
havingin interfaceAbstractQuery<T>- Specified by:
havingin interfaceJpaSelectCriteria<T>
-
having
@Nonnull public JpaSelectCriteria<T> having(@Nonnull List<? extends Expression<Boolean>> restrictions) Description copied from interface:JpaSelectCriteriaSet the group restriction.- Specified by:
havingin interfaceAbstractQuery<T>- Specified by:
havingin interfaceJpaSelectCriteria<T>
-
appendHqlString
-
equals
-
hashCode
-
isCompatible
- Specified by:
isCompatiblein interfaceSqmCacheable
-
cacheHashCode
public int cacheHashCode()- Specified by:
cacheHashCodein interfaceSqmCacheable
-
getResultSelection
-