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

public Class QuerySqmImpl<R>

extends AbstractSelectionQuery<R>
implements SqmQueryImplementor<R>, InterpretationsKeySource, DomainQueryExecutionContext
Class Inheritance
All Implemented Interfaces
org.hibernate.query.spi.DomainQueryExecutionContext, org.hibernate.query.sqm.internal.SqmInterpretationsKey.InterpretationsKeySource, org.hibernate.query.sqm.internal.SqmInterpretationsKey.CacheabilityInfluencers, org.hibernate.query.hql.spi.SqmQueryImplementor, org.hibernate.query.named.NameableQuery, org.hibernate.query.spi.SqmQuery, org.hibernate.query.CommonQueryContract, org.hibernate.query.spi.QueryImplementor, org.hibernate.query.Query, jakarta.persistence.TypedQuery, jakarta.persistence.Query, org.hibernate.query.MutationQuery, org.hibernate.query.SelectionQuery
Imports
java.io.Serializable, java.time.Instant, java.util.ArrayList, .Arrays, .Calendar, .Collection, .Collections, .Date, .HashSet, .List, .Map, java.util.function.Supplier, jakarta.persistence.EntityGraph, .CacheRetrieveMode, .CacheStoreMode, .FlushModeType, .LockModeType, .Parameter, .PersistenceException, .TemporalType, org.hibernate.CacheMode, .FlushMode, .HibernateException, .LockMode, .LockOptions, .ScrollMode, .TypeMismatchException, org.hibernate.cfg.AvailableSettings, org.hibernate.engine.query.spi.EntityGraphQueryHint, org.hibernate.engine.spi.LoadQueryInfluencers, .SessionFactoryImplementor, .SharedSessionContractImplementor, org.hibernate.generator.Generator, org.hibernate.graph.GraphSemantic, .RootGraph, org.hibernate.graph.spi.AppliedGraph, .RootGraphImplementor, org.hibernate.id.BulkInsertionCapableIdentifierGenerator, .OptimizableGenerator, org.hibernate.id.enhanced.Optimizer, org.hibernate.internal.CoreLogging, .CoreMessageLogger, org.hibernate.metamodel.mapping.EntityIdentifierMapping, org.hibernate.metamodel.mapping.internal.SingleAttributeIdentifierMapping, org.hibernate.metamodel.model.domain.EntityDomainType, org.hibernate.persister.entity.AbstractEntityPersister, .EntityPersister, org.hibernate.query.BindableType, .IllegalQueryOperationException, .IllegalSelectQueryException, .ImmutableEntityUpdateQueryHandlingMode, .Order, .Query, .QueryLogging, .QueryParameter, .ResultListTransformer, .SemanticException, .TupleTransformer, org.hibernate.query.criteria.internal.NamedCriteriaQueryMementoImpl, org.hibernate.query.hql.internal.NamedHqlQueryMementoImpl, .QuerySplitter, org.hibernate.query.hql.spi.SqmQueryImplementor, org.hibernate.query.internal.DelegatingDomainQueryExecutionContext, .ParameterMetadataImpl, .QueryParameterBindingsImpl, org.hibernate.query.named.NamedQueryMemento, org.hibernate.query.spi.AbstractSelectionQuery, .DelegatingQueryOptions, .DomainQueryExecutionContext, .HqlInterpretation, .MutableQueryOptions, .NonSelectQueryPlan, .ParameterMetadataImplementor, .QueryEngine, .QueryInterpretationCache, .QueryOptions, .QueryParameterBindings, .ScrollableResultsImplementor, .SelectQueryPlan, org.hibernate.query.sqm.SqmPathSource, org.hibernate.query.sqm.internal.SqmInterpretationsKey.InterpretationsKeySource, org.hibernate.query.sqm.mutation.spi.SqmMultiTableMutationStrategy, org.hibernate.query.sqm.tree.SqmCopyContext, .SqmStatement, .SqmTypedNode, org.hibernate.query.sqm.tree.delete.SqmDeleteStatement, org.hibernate.query.sqm.tree.domain.SqmPath, org.hibernate.query.sqm.tree.expression.JpaCriteriaParameter, .SqmExpression, .SqmJpaCriteriaParameterWrapper, .SqmParameter, org.hibernate.query.sqm.tree.from.SqmRoot, org.hibernate.query.sqm.tree.insert.SqmInsertSelectStatement, .SqmInsertStatement, .SqmInsertValuesStatement, .SqmValues, org.hibernate.query.sqm.tree.select.SqmQueryPart, .SqmSelectStatement, .SqmSelectableNode, org.hibernate.query.sqm.tree.update.SqmAssignment, .SqmUpdateStatement, org.hibernate.sql.results.internal.TupleMetadata, org.hibernate.sql.results.spi.ListResultsConsumer

Query implementation based on an SQM
Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final DomainParameterXref
private final String
private static final CoreMessageLogger
private final QueryParameterBindingsImpl
private final ParameterMetadataImplementor
private final Class<R>
private SqmStatement<R>
private final TupleMetadata
Inherited from org.hibernate.query.spi.AbstractSelectionQuery:
CRITERIA_HQL_STRING

Constructor Summary

AccessConstructor and Description
public
QuerySqmImpl(NamedHqlQueryMementoImpl memento, Class<R> expectedResultType, SharedSessionContractImplementor session)

Creates a Query instance from a named HQL memento

public
public
QuerySqmImpl(String hql, HqlInterpretation hqlInterpretation, Class<R> resultType, SharedSessionContractImplementor session)

Form used for HQL queries

public
QuerySqmImpl(SqmStatement<R> criteria, Class<R> expectedResultType, SharedSessionContractImplementor producer)

Form used for criteria queries

Method Summary

Modifier and TypeMethod and Description
public SqmQueryImplementor<R>
addQueryHint(String
The database specific query hint to add.
hint
)

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.addQueryHint.

Add a database query hint to the SQL query.
protected void
protected void
public SqmQueryImplementor<R>
applyGraph(RootGraph<J>
The graph to apply.
graph
,
GraphSemantic
The semantic to use when applying the graph
semantic
)

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.applyGraph.

Apply the given graph using the given semantic
protected void
protected void
protected void
protected void
private <T> void
private NonSelectQueryPlan
private SelectQueryPlan<R>
private NonSelectQueryPlan
private <T> SelectQueryPlan<T>
buildConcreteSelectQueryPlan(SqmSelectStatement<?> concreteSqmStatement, Class<T> resultType, QueryOptions queryOptions)

private NonSelectQueryPlan
private NonSelectQueryPlan
private NonSelectQueryPlan
private SelectQueryPlan<R>
private NonSelectQueryPlan
protected void
public Query<R>
protected int
protected List<R>
protected ScrollableResultsImplementor<R>
public Query<R>
public int
executeUpdate()

Implements org.hibernate.query.Query.executeUpdate.

Execute an insert, update, or delete statement, and return the number of affected entities.
protected DomainQueryExecutionContext
executionContextForDoList(boolean containsCollectionFetches, boolean hasLimit, boolean needsDistinct)

public DomainParameterXref
public FlushModeType
public LoadQueryInfluencers
public LockModeType
public QueryParameterBindings
public ParameterMetadataImplementor
public QueryParameterBindings
public String
public Class<R>
public SqmStatement<R>
public TupleMetadata
protected boolean
protected boolean
public Supplier<Boolean>
public boolean
protected boolean
protected void
protected boolean
private NonSelectQueryPlan
private SelectQueryPlan<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public Query<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
setFirstResult(int
position of the first result, numbered from 0
startPosition
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setFirstResult.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setFirstResult, org.hibernate.query.SelectionQuery.setFirstResult.

Set the first row position to return from the query results.
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
setLockMode(String
A query alias
alias
,
LockMode
The lock mode to apply
lockMode
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setLockMode.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setLockMode, org.hibernate.query.SelectionQuery.setLockMode.

Set the LockMode to use for particular alias defined in the FROM clause of the query.
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
setLockOptions(LockOptions
The lock options to apply to the query.
lockOptions
)

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setLockOptions.

Apply the given lock options to this query.
public SqmQueryImplementor<R>
setMaxResults(int
maximum number of results to retrieve
maxResult
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setMaxResults.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setMaxResults, org.hibernate.query.SelectionQuery.setMaxResults.

Set the max number of rows requested for the query results.
public void
public void
public void
public Query<R>
setOrder(List<Order<? super R>>
one or more instances of Order
orderList
)

Implements org.hibernate.query.Query.setOrder, org.hibernate.query.SelectionQuery.setOrder.

If the result type of this query is an entity class, add one or more rules for ordering the query results.
public Query<R>
setOrder(Order<? super R>
an instance of Order
order
)

Implements org.hibernate.query.Query.setOrder, org.hibernate.query.SelectionQuery.setOrder.

If the result type of this query is an entity class, add a rule for ordering the query results.
public SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameter(String name, P value, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameter.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameter, org.hibernate.query.SelectionQuery.setParameter, org.hibernate.query.CommonQueryContract.setParameter.

Bind the given argument to a named query parameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameter(int position, P value, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameter.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameter, org.hibernate.query.SelectionQuery.setParameter, org.hibernate.query.CommonQueryContract.setParameter.

Bind the given argument to an ordinal query parameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameter(QueryParameter<P>
the query parameter memento
parameter
,
P
the argument, which might be null
value
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameter.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameter, org.hibernate.query.SelectionQuery.setParameter, org.hibernate.query.CommonQueryContract.setParameter.

Bind an argument to the query parameter represented by the given QueryParameter.
public <P> SqmQueryImplementor<R>
setParameter(QueryParameter<P>
the query parameter memento
parameter
,
P
the argument, which might be null
value
,
Class<P>
a BindableType representing the type of the parameter
javaType
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameter.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameter, org.hibernate.query.SelectionQuery.setParameter, org.hibernate.query.CommonQueryContract.setParameter.

Bind an argument to the query parameter represented by the given QueryParameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
setParameter(QueryParameter<P>
the query parameter memento
parameter
,
P
the argument, which might be null
value
,
BindableType<P>
an BindableType representing the type of the parameter
type
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameter.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameter, org.hibernate.query.SelectionQuery.setParameter, org.hibernate.query.CommonQueryContract.setParameter.

Bind an argument to the query parameter represented by the given QueryParameter using the given BindableType.
public <P> SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameterList(String name, Collection<? extends P> values, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameterList.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameterList, org.hibernate.query.SelectionQuery.setParameterList, org.hibernate.query.CommonQueryContract.setParameterList.

Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameterList(String name, P[] values, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameterList.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameterList, org.hibernate.query.SelectionQuery.setParameterList, org.hibernate.query.CommonQueryContract.setParameterList.

Bind multiple arguments to a named query parameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameterList(int position, Collection<? extends P> values, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameterList.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameterList, org.hibernate.query.SelectionQuery.setParameterList, org.hibernate.query.CommonQueryContract.setParameterList.

Bind multiple arguments to an ordinal query parameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameterList(int position, P[] values, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameterList.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameterList, org.hibernate.query.SelectionQuery.setParameterList, org.hibernate.query.CommonQueryContract.setParameterList.

Bind multiple arguments to an ordinal query parameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameterList(QueryParameter<P> parameter, Collection<? extends P> values, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameterList.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameterList, org.hibernate.query.SelectionQuery.setParameterList, org.hibernate.query.CommonQueryContract.setParameterList.

Bind multiple arguments to the query parameter represented by the given QueryParameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
public <P> SqmQueryImplementor<R>
setParameterList(QueryParameter<P> parameter, P[] values, Class<P> javaType)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setParameterList.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setParameterList, org.hibernate.query.SelectionQuery.setParameterList, org.hibernate.query.CommonQueryContract.setParameterList.

Bind multiple arguments to the query parameter represented by the given QueryParameter using the given Class reference to attempt to determine the BindableType to use.
public <P> SqmQueryImplementor<R>
public SqmQueryImplementor<R>
setProperties(Object
any JavaBean or POJO
bean
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setProperties.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setProperties, org.hibernate.query.SelectionQuery.setProperties, org.hibernate.query.CommonQueryContract.setProperties.

Bind the property values of the given bean to named parameters of the query, matching property names with parameter names and mapping property types to Hibernate types using heuristics.
public SqmQueryImplementor<R>
setProperties(Map<K, V>
a Map of names to arguments
bean
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setProperties.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setProperties, org.hibernate.query.SelectionQuery.setProperties, org.hibernate.query.CommonQueryContract.setProperties.

Bind the values of the given Map for each named parameters of the query, matching key names with parameter names and mapping value types to Hibernate types using heuristics.
public SqmQueryImplementor<R>
setQueryPlanCacheable(boolean queryPlanCacheable)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setQueryPlanCacheable.

Implements org.hibernate.query.SelectionQuery.setQueryPlanCacheable.

Enable/disable query plan caching for this query.
public SqmQueryImplementor<R>
setReadOnly(boolean
true indicates that entities and proxies loaded by the query are to be put in read-only mode; false indicates that entities and proxies loaded by the query will be put in modifiable mode
readOnly
)

Overrides org.hibernate.query.spi.AbstractSelectionQuery.setReadOnly.

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.setReadOnly, org.hibernate.query.SelectionQuery.setReadOnly.

Set the read-only/modifiable mode for entities and proxies loaded by this Query.
public SqmQueryImplementor<R>
public SqmQueryImplementor<R>
public <T> SqmQueryImplementor<T>
public NamedQueryMemento
toMemento(String name)

Implements org.hibernate.query.hql.spi.SqmQueryImplementor.toMemento.

Convert the query into the memento
public static QueryOptions
public <T> T
unwrap(Class<T>
the class of the object to be returned. This is normally either the underlying query implementation class or an interface that it implements.
cls
)

Implements jakarta.persistence.Query.unwrap.

Return an object of the specified type to allow access to the provider-specific API.
private void
validateStatement(SqmStatement<R> sqmStatement, Class<R> resultType)

private void
verifyImmutableEntityUpdate(String hqlString, SqmUpdateStatement<R> sqmStatement, SessionFactoryImplementor factory)

Deprecated as a consequence of SessionFactoryImplementor being deprecated.
private void
verifyInsertTypesMatch(String hqlString, SqmInsertStatement<R> sqmStatement)

private void
verifyInsertTypesMatch(String hqlString, List<SqmPath<?>> insertionTargetPaths, List<? extends SqmTypedNode<?>> expressions)

protected void
protected void
private void
verifyUpdateTypesMatch(String hqlString, SqmUpdateStatement<R> sqmStatement)

Inherited from org.hibernate.query.spi.AbstractSelectionQuery:
afterQueryafterQueryafterQueryHandlingFetchProfilesapplyOptionsapplyOptionsbeforeQuerybeforeQueryHandlingFetchProfilesbuildTupleMetadatacheckQueryReturnTypegetCacheModegetCacheRegiongetCacheRetrieveModegetCacheStoreModegetCallbackgetFetchSizegetHibernateLockModegetLockOptionsgetResultStreamgetSessionFactorygetSingleResultgetSingleResultOrNullhasAppliedGraphhasCallbackActionshasLimitisCacheableisReadOnlylistrequiresTxnresetCallbackscrollscrollsetAliasSpecificLockModesetFollowOnLockingsetHibernateLockModestreamuniqueElementuniqueResultuniqueResultOptionalverifyResultTypevisitQueryReturnType