Class LoaderSqlAstCreationState
- java.lang.Object
-
- org.hibernate.loader.ast.internal.LoaderSqlAstCreationState
-
- All Implemented Interfaces:
QueryOptions
,SqlAstCreationState
,SqlAstProcessingState
,SqlAstQueryNodeProcessingState
,SqlAstQueryPartProcessingState
,DomainResultCreationState
public class LoaderSqlAstCreationState extends Object implements SqlAstQueryPartProcessingState, SqlAstCreationState, DomainResultCreationState, QueryOptions
Helper used when generating the database-snapshot select query
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
LoaderSqlAstCreationState.FetchProcessor
-
Field Summary
-
Fields inherited from interface org.hibernate.query.spi.QueryOptions
NONE, READ_ONLY, READ_WRITE
-
-
Constructor Summary
Constructors Constructor Description LoaderSqlAstCreationState(QueryPart queryPart, SqlAliasBaseManager sqlAliasBaseManager, FromClauseAccess fromClauseAccess, LockOptions lockOptions, LoaderSqlAstCreationState.FetchProcessor fetchProcessor, boolean forceIdentifierSelection, LoadQueryInfluencers loadQueryInfluencers, SqlAstCreationContext sf)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
applyOnlyLoadByKeyFilters()
void
applyOrdering(TableGroup tableGroup, OrderByFragment orderByFragment)
void
applyPredicate(Predicate predicate)
Apply the predicate to be used for the final statement.boolean
forceIdentifierSelection()
Whether forcing the selection of the identifier is in effect for this creationAppliedGraph
getAppliedGraph()
JPAEntityGraph
explicitly applied to the query.CacheRetrieveMode
getCacheRetrieveMode()
Controls whether query results are read from the cache.CacheStoreMode
getCacheStoreMode()
Controls whether query results are put into the cache.String
getComment()
The SQL comment to apply to the interpreted SQL query, for dialects which support SQL commentsSqlAstCreationContext
getCreationContext()
ForeignKeyDescriptor.Nature
getCurrentlyResolvingForeignKeyPart()
Returns the part of the foreign key that is currently being resolved, ornull
if no foreign key is currently being resolved.SqlAstProcessingState
getCurrentProcessingState()
List<String>
getDatabaseHints()
Hints to apply to the interpreted SQL querySet<String>
getDisabledFetchProfiles()
The explicitly disabled profiles for this querySet<String>
getEnabledFetchProfiles()
The explicitly enabled profiles for this queryInteger
getFetchSize()
The fetch size to be applied to the JDBC query.FlushMode
getFlushMode()
The flush mode to use for the query executionFromClause
getFromClause()
Returns the in-flight from clause for the query node.FromClauseAccess
getFromClauseAccess()
Map<SqmFrom<?,?>,Boolean>
getFromRegistrations()
Returns the treated SqmFroms and whether theirEntityNameUse.TREAT
should be downgraded toEntityNameUse.EXPRESSION
.QueryPart
getInflightQueryPart()
Get the QueryPart being processed as part of this state.Limit
getLimit()
The limit to the query results.LoadQueryInfluencers
getLoadQueryInfluencers()
LockOptions
getLockOptions()
Describes the locking to apply to the query resultsSqlAstProcessingState
getParentState()
Boolean
getQueryPlanCachingEnabled()
Should the query plan of the query be cached?String
getResultCacheRegionName()
The query cache region in which the results should be cached.ResultListTransformer<?>
getResultListTransformer()
Transformer applied to the query to transform the structure of the overall resultsSqlAliasBaseGenerator
getSqlAliasBaseGenerator()
SqlAstCreationState
getSqlAstCreationState()
The underlying state for SQL AST creationSqlExpressionResolver
getSqlExpressionResolver()
Integer
getTimeout()
The timeout to apply to the query.TupleTransformer<?>
getTupleTransformer()
Transformer applied to the query to transform the structure of each "row" in the resultsboolean
isAssociationKeyVisited(AssociationKey associationKey)
Checks whether the given circularityKey is registeredBoolean
isReadOnly()
Should entities returned from the query be marked read-only.boolean
isRegisteringVisitedAssociationKeys()
Is this state accepting circularity detection keys?boolean
isResolvingCircularFetch()
Boolean
isResultCachingEnabled()
Should results from the query be cached?void
registerFromUsage(SqmFrom<?,?> sqmFrom, boolean downgradeTreatUses)
Registers that the given SqmFrom was used in an expression and whether to downgradeEntityNameUse.TREAT
of it.void
registerLockMode(String identificationVariable, LockMode explicitLockMode)
void
registerTreatedFrom(SqmFrom<?,?> sqmFrom)
Registers that the given SqmFrom is treated.boolean
registerVisitedAssociationKey(AssociationKey associationKey)
Registers a circularity detection keyvoid
removeVisitedAssociationKey(AssociationKey associationKey)
Removes the registration of a circularity detection keyModelPart
resolveModelPart(NavigablePath navigablePath)
Resolve the ModelPart associated with a given NavigablePath.void
setCurrentlyResolvingForeignKeyPart(ForeignKeyDescriptor.Nature currentlyResolvingForeignKeySide)
void
setResolvingCircularFetch(boolean resolvingCircularFetch)
ImmutableFetchList
visitFetches(FetchParent fetchParent)
Visit fetches for the given parent.<R> R
withNestedFetchParent(FetchParent fetchParent, Function<FetchParent,R> action)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.sql.results.graph.DomainResultCreationState
getSqlAliasBaseManager, visitDiscriminatorFetch, visitEmbeddableDiscriminatorFetch, visitIdentifierFetch, visitNestedFetches
-
Methods inherited from interface org.hibernate.query.spi.QueryOptions
getCacheMode, getEffectiveLimit, getFirstRow, getMaxRows, getUniqueSemantic, hasLimit
-
Methods inherited from interface org.hibernate.sql.ast.spi.SqlAstCreationState
registerEntityNameUsage, supportsEntityNameUsage
-
Methods inherited from interface org.hibernate.sql.ast.spi.SqlAstProcessingState
isTopLevel
-
-
-
-
Constructor Detail
-
LoaderSqlAstCreationState
public LoaderSqlAstCreationState(QueryPart queryPart, SqlAliasBaseManager sqlAliasBaseManager, FromClauseAccess fromClauseAccess, LockOptions lockOptions, LoaderSqlAstCreationState.FetchProcessor fetchProcessor, boolean forceIdentifierSelection, LoadQueryInfluencers loadQueryInfluencers, SqlAstCreationContext sf)
-
-
Method Detail
-
applyOrdering
public void applyOrdering(TableGroup tableGroup, OrderByFragment orderByFragment)
- Specified by:
applyOrdering
in interfaceSqlAstCreationState
-
getCreationContext
public SqlAstCreationContext getCreationContext()
- Specified by:
getCreationContext
in interfaceSqlAstCreationState
-
getCurrentProcessingState
public SqlAstProcessingState getCurrentProcessingState()
- Specified by:
getCurrentProcessingState
in interfaceSqlAstCreationState
-
getInflightQueryPart
public QueryPart getInflightQueryPart()
Description copied from interface:SqlAstQueryPartProcessingState
Get the QueryPart being processed as part of this state. It is considered in-flight as it is probably still being built.- Specified by:
getInflightQueryPart
in interfaceSqlAstQueryPartProcessingState
-
getFromClause
public FromClause getFromClause()
Description copied from interface:SqlAstQueryNodeProcessingState
Returns the in-flight from clause for the query node.- Specified by:
getFromClause
in interfaceSqlAstQueryNodeProcessingState
-
applyPredicate
public void applyPredicate(Predicate predicate)
Description copied from interface:SqlAstQueryNodeProcessingState
Apply the predicate to be used for the final statement.- Specified by:
applyPredicate
in interfaceSqlAstQueryNodeProcessingState
-
registerTreatedFrom
public void registerTreatedFrom(SqmFrom<?,?> sqmFrom)
Description copied from interface:SqlAstQueryNodeProcessingState
Registers that the given SqmFrom is treated.- Specified by:
registerTreatedFrom
in interfaceSqlAstQueryNodeProcessingState
-
registerFromUsage
public void registerFromUsage(SqmFrom<?,?> sqmFrom, boolean downgradeTreatUses)
Description copied from interface:SqlAstQueryNodeProcessingState
Registers that the given SqmFrom was used in an expression and whether to downgradeEntityNameUse.TREAT
of it.- Specified by:
registerFromUsage
in interfaceSqlAstQueryNodeProcessingState
-
getFromRegistrations
public Map<SqmFrom<?,?>,Boolean> getFromRegistrations()
Description copied from interface:SqlAstQueryNodeProcessingState
Returns the treated SqmFroms and whether theirEntityNameUse.TREAT
should be downgraded toEntityNameUse.EXPRESSION
.- Specified by:
getFromRegistrations
in interfaceSqlAstQueryNodeProcessingState
-
getSqlExpressionResolver
public SqlExpressionResolver getSqlExpressionResolver()
- Specified by:
getSqlExpressionResolver
in interfaceSqlAstCreationState
- Specified by:
getSqlExpressionResolver
in interfaceSqlAstProcessingState
-
getFromClauseAccess
public FromClauseAccess getFromClauseAccess()
- Specified by:
getFromClauseAccess
in interfaceSqlAstCreationState
-
getSqlAliasBaseGenerator
public SqlAliasBaseGenerator getSqlAliasBaseGenerator()
- Specified by:
getSqlAliasBaseGenerator
in interfaceSqlAstCreationState
-
getLoadQueryInfluencers
public LoadQueryInfluencers getLoadQueryInfluencers()
- Specified by:
getLoadQueryInfluencers
in interfaceSqlAstCreationState
-
applyOnlyLoadByKeyFilters
public boolean applyOnlyLoadByKeyFilters()
- Specified by:
applyOnlyLoadByKeyFilters
in interfaceSqlAstCreationState
-
registerLockMode
public void registerLockMode(String identificationVariable, LockMode explicitLockMode)
- Specified by:
registerLockMode
in interfaceSqlAstCreationState
-
visitFetches
public ImmutableFetchList visitFetches(FetchParent fetchParent)
Description copied from interface:DomainResultCreationState
Visit fetches for the given parent. We walk fetches via the SqlAstCreationContext because each "context" will define differently what should be fetched (HQL versus load)- Specified by:
visitFetches
in interfaceDomainResultCreationState
-
withNestedFetchParent
public <R> R withNestedFetchParent(FetchParent fetchParent, Function<FetchParent,R> action)
- Specified by:
withNestedFetchParent
in interfaceDomainResultCreationState
-
isResolvingCircularFetch
public boolean isResolvingCircularFetch()
- Specified by:
isResolvingCircularFetch
in interfaceDomainResultCreationState
-
setResolvingCircularFetch
public void setResolvingCircularFetch(boolean resolvingCircularFetch)
- Specified by:
setResolvingCircularFetch
in interfaceDomainResultCreationState
-
getCurrentlyResolvingForeignKeyPart
public ForeignKeyDescriptor.Nature getCurrentlyResolvingForeignKeyPart()
Description copied from interface:DomainResultCreationState
Returns the part of the foreign key that is currently being resolved, ornull
if no foreign key is currently being resolved.- Specified by:
getCurrentlyResolvingForeignKeyPart
in interfaceDomainResultCreationState
-
setCurrentlyResolvingForeignKeyPart
public void setCurrentlyResolvingForeignKeyPart(ForeignKeyDescriptor.Nature currentlyResolvingForeignKeySide)
- Specified by:
setCurrentlyResolvingForeignKeyPart
in interfaceDomainResultCreationState
-
forceIdentifierSelection
public boolean forceIdentifierSelection()
Description copied from interface:DomainResultCreationState
Whether forcing the selection of the identifier is in effect for this creation- Specified by:
forceIdentifierSelection
in interfaceDomainResultCreationState
-
getSqlAstCreationState
public SqlAstCreationState getSqlAstCreationState()
Description copied from interface:DomainResultCreationState
The underlying state for SQL AST creation- Specified by:
getSqlAstCreationState
in interfaceDomainResultCreationState
- Specified by:
getSqlAstCreationState
in interfaceSqlAstProcessingState
-
registerVisitedAssociationKey
public boolean registerVisitedAssociationKey(AssociationKey associationKey)
Description copied from interface:DomainResultCreationState
Registers a circularity detection key- Specified by:
registerVisitedAssociationKey
in interfaceDomainResultCreationState
-
removeVisitedAssociationKey
public void removeVisitedAssociationKey(AssociationKey associationKey)
Description copied from interface:DomainResultCreationState
Removes the registration of a circularity detection key- Specified by:
removeVisitedAssociationKey
in interfaceDomainResultCreationState
-
isAssociationKeyVisited
public boolean isAssociationKeyVisited(AssociationKey associationKey)
Description copied from interface:DomainResultCreationState
Checks whether the given circularityKey is registered- Specified by:
isAssociationKeyVisited
in interfaceDomainResultCreationState
-
isRegisteringVisitedAssociationKeys
public boolean isRegisteringVisitedAssociationKeys()
Description copied from interface:DomainResultCreationState
Is this state accepting circularity detection keys?- Specified by:
isRegisteringVisitedAssociationKeys
in interfaceDomainResultCreationState
-
resolveModelPart
public ModelPart resolveModelPart(NavigablePath navigablePath)
Description copied from interface:DomainResultCreationState
Resolve the ModelPart associated with a given NavigablePath. More specific ModelParts should be preferred - e.g. the SingularAssociationAttributeMapping rather than just the EntityTypeMapping for the associated type- Specified by:
resolveModelPart
in interfaceDomainResultCreationState
-
getParentState
public SqlAstProcessingState getParentState()
- Specified by:
getParentState
in interfaceSqlAstProcessingState
-
getTimeout
public Integer getTimeout()
Description copied from interface:QueryOptions
The timeout to apply to the query. May also be defined at the transaction level usingTransaction.getTimeout()
- Specified by:
getTimeout
in interfaceQueryOptions
-
getFlushMode
public FlushMode getFlushMode()
Description copied from interface:QueryOptions
The flush mode to use for the query execution- Specified by:
getFlushMode
in interfaceQueryOptions
-
isReadOnly
public Boolean isReadOnly()
Description copied from interface:QueryOptions
Should entities returned from the query be marked read-only.- Specified by:
isReadOnly
in interfaceQueryOptions
-
getAppliedGraph
public AppliedGraph getAppliedGraph()
Description copied from interface:QueryOptions
JPAEntityGraph
explicitly applied to the query.- Specified by:
getAppliedGraph
in interfaceQueryOptions
-
getTupleTransformer
public TupleTransformer<?> getTupleTransformer()
Description copied from interface:QueryOptions
Transformer applied to the query to transform the structure of each "row" in the results- Specified by:
getTupleTransformer
in interfaceQueryOptions
-
getResultListTransformer
public ResultListTransformer<?> getResultListTransformer()
Description copied from interface:QueryOptions
Transformer applied to the query to transform the structure of the overall results- Specified by:
getResultListTransformer
in interfaceQueryOptions
-
isResultCachingEnabled
public Boolean isResultCachingEnabled()
Description copied from interface:QueryOptions
Should results from the query be cached?- Specified by:
isResultCachingEnabled
in interfaceQueryOptions
- See Also:
QueryOptions.getCacheMode()
,QueryOptions.getResultCacheRegionName()
-
getQueryPlanCachingEnabled
public Boolean getQueryPlanCachingEnabled()
Description copied from interface:QueryOptions
Should the query plan of the query be cached?- Specified by:
getQueryPlanCachingEnabled
in interfaceQueryOptions
-
getCacheRetrieveMode
public CacheRetrieveMode getCacheRetrieveMode()
Description copied from interface:QueryOptions
Controls whether query results are read from the cache. No effect unlessQueryOptions.isResultCachingEnabled()
returnstrue
- Specified by:
getCacheRetrieveMode
in interfaceQueryOptions
- See Also:
CacheMode
-
getCacheStoreMode
public CacheStoreMode getCacheStoreMode()
Description copied from interface:QueryOptions
Controls whether query results are put into the cache. No effect unlessQueryOptions.isResultCachingEnabled()
returnstrue
- Specified by:
getCacheStoreMode
in interfaceQueryOptions
- See Also:
CacheMode
-
getResultCacheRegionName
public String getResultCacheRegionName()
Description copied from interface:QueryOptions
The query cache region in which the results should be cached. No effect unlessQueryOptions.isResultCachingEnabled()
returnstrue
- Specified by:
getResultCacheRegionName
in interfaceQueryOptions
-
getLockOptions
public LockOptions getLockOptions()
Description copied from interface:QueryOptions
Describes the locking to apply to the query results- Specified by:
getLockOptions
in interfaceQueryOptions
-
getComment
public String getComment()
Description copied from interface:QueryOptions
The SQL comment to apply to the interpreted SQL query, for dialects which support SQL comments- Specified by:
getComment
in interfaceQueryOptions
-
getDatabaseHints
public List<String> getDatabaseHints()
Description copied from interface:QueryOptions
Hints to apply to the interpreted SQL query- Specified by:
getDatabaseHints
in interfaceQueryOptions
-
getFetchSize
public Integer getFetchSize()
Description copied from interface:QueryOptions
The fetch size to be applied to the JDBC query.- Specified by:
getFetchSize
in interfaceQueryOptions
- See Also:
Statement.getFetchSize()
-
getLimit
public Limit getLimit()
Description copied from interface:QueryOptions
The limit to the query results. May also be accessed viaQueryOptions.getFirstRow()
andQueryOptions.getMaxRows()
- Specified by:
getLimit
in interfaceQueryOptions
-
getEnabledFetchProfiles
public Set<String> getEnabledFetchProfiles()
Description copied from interface:QueryOptions
The explicitly enabled profiles for this query- Specified by:
getEnabledFetchProfiles
in interfaceQueryOptions
-
getDisabledFetchProfiles
public Set<String> getDisabledFetchProfiles()
Description copied from interface:QueryOptions
The explicitly disabled profiles for this query- Specified by:
getDisabledFetchProfiles
in interfaceQueryOptions
-
-