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 interfaceLoaderSqlAstCreationState.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 booleanapplyOnlyLoadByKeyFilters()voidapplyOrdering(TableGroup tableGroup, OrderByFragment orderByFragment)voidapplyPredicate(Predicate predicate)Apply the predicate to be used for the final statement.booleanforceIdentifierSelection()Whether forcing the selection of the identifier is in effect for this creationAppliedGraphgetAppliedGraph()JPAEntityGraphexplicitly applied to the query.CacheRetrieveModegetCacheRetrieveMode()Controls whether query results are read from the cache.CacheStoreModegetCacheStoreMode()Controls whether query results are put into the cache.StringgetComment()The SQL comment to apply to the interpreted SQL query, for dialects which support SQL commentsSqlAstCreationContextgetCreationContext()ForeignKeyDescriptor.NaturegetCurrentlyResolvingForeignKeyPart()Returns the part of the foreign key that is currently being resolved, ornullif no foreign key is currently being resolved.SqlAstProcessingStategetCurrentProcessingState()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 queryIntegergetFetchSize()The fetch size to be applied to the JDBC query.FlushModegetFlushMode()The flush mode to use for the query executionFromClausegetFromClause()Returns the in-flight from clause for the query node.FromClauseAccessgetFromClauseAccess()Map<SqmFrom<?,?>,Boolean>getFromRegistrations()Returns the treated SqmFroms and whether theirEntityNameUse.TREATshould be downgraded toEntityNameUse.EXPRESSION.QueryPartgetInflightQueryPart()Get the QueryPart being processed as part of this state.LimitgetLimit()The limit to the query results.LoadQueryInfluencersgetLoadQueryInfluencers()LockOptionsgetLockOptions()Describes the locking to apply to the query resultsSqlAstProcessingStategetParentState()BooleangetQueryPlanCachingEnabled()Should the query plan of the query be cached?StringgetResultCacheRegionName()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 resultsSqlAliasBaseGeneratorgetSqlAliasBaseGenerator()SqlAstCreationStategetSqlAstCreationState()The underlying state for SQL AST creationSqlExpressionResolvergetSqlExpressionResolver()IntegergetTimeout()The timeout to apply to the query.TupleTransformer<?>getTupleTransformer()Transformer applied to the query to transform the structure of each "row" in the resultsbooleanisAssociationKeyVisited(AssociationKey associationKey)Checks whether the given circularityKey is registeredBooleanisReadOnly()Should entities returned from the query be marked read-only.booleanisRegisteringVisitedAssociationKeys()Is this state accepting circularity detection keys?booleanisResolvingCircularFetch()BooleanisResultCachingEnabled()Should results from the query be cached?voidregisterFromUsage(SqmFrom<?,?> sqmFrom, boolean downgradeTreatUses)Registers that the given SqmFrom was used in an expression and whether to downgradeEntityNameUse.TREATof it.voidregisterLockMode(String identificationVariable, LockMode explicitLockMode)voidregisterTreatedFrom(SqmFrom<?,?> sqmFrom)Registers that the given SqmFrom is treated.booleanregisterVisitedAssociationKey(AssociationKey associationKey)Registers a circularity detection keyvoidremoveVisitedAssociationKey(AssociationKey associationKey)Removes the registration of a circularity detection keyModelPartresolveModelPart(NavigablePath navigablePath)Resolve the ModelPart associated with a given NavigablePath.voidsetCurrentlyResolvingForeignKeyPart(ForeignKeyDescriptor.Nature currentlyResolvingForeignKeySide)voidsetResolvingCircularFetch(boolean resolvingCircularFetch)ImmutableFetchListvisitFetches(FetchParent fetchParent)Visit fetches for the given parent.<R> RwithNestedFetchParent(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
isProcedureOrNativeQuery, 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:
applyOrderingin interfaceSqlAstCreationState
-
getCreationContext
public SqlAstCreationContext getCreationContext()
- Specified by:
getCreationContextin interfaceSqlAstCreationState
-
getCurrentProcessingState
public SqlAstProcessingState getCurrentProcessingState()
- Specified by:
getCurrentProcessingStatein interfaceSqlAstCreationState
-
getInflightQueryPart
public QueryPart getInflightQueryPart()
Description copied from interface:SqlAstQueryPartProcessingStateGet the QueryPart being processed as part of this state. It is considered in-flight as it is probably still being built.- Specified by:
getInflightQueryPartin interfaceSqlAstQueryPartProcessingState
-
getFromClause
public FromClause getFromClause()
Description copied from interface:SqlAstQueryNodeProcessingStateReturns the in-flight from clause for the query node.- Specified by:
getFromClausein interfaceSqlAstQueryNodeProcessingState
-
applyPredicate
public void applyPredicate(Predicate predicate)
Description copied from interface:SqlAstQueryNodeProcessingStateApply the predicate to be used for the final statement.- Specified by:
applyPredicatein interfaceSqlAstQueryNodeProcessingState
-
registerTreatedFrom
public void registerTreatedFrom(SqmFrom<?,?> sqmFrom)
Description copied from interface:SqlAstQueryNodeProcessingStateRegisters that the given SqmFrom is treated.- Specified by:
registerTreatedFromin interfaceSqlAstQueryNodeProcessingState
-
registerFromUsage
public void registerFromUsage(SqmFrom<?,?> sqmFrom, boolean downgradeTreatUses)
Description copied from interface:SqlAstQueryNodeProcessingStateRegisters that the given SqmFrom was used in an expression and whether to downgradeEntityNameUse.TREATof it.- Specified by:
registerFromUsagein interfaceSqlAstQueryNodeProcessingState
-
getFromRegistrations
public Map<SqmFrom<?,?>,Boolean> getFromRegistrations()
Description copied from interface:SqlAstQueryNodeProcessingStateReturns the treated SqmFroms and whether theirEntityNameUse.TREATshould be downgraded toEntityNameUse.EXPRESSION.- Specified by:
getFromRegistrationsin interfaceSqlAstQueryNodeProcessingState
-
getSqlExpressionResolver
public SqlExpressionResolver getSqlExpressionResolver()
- Specified by:
getSqlExpressionResolverin interfaceSqlAstCreationState- Specified by:
getSqlExpressionResolverin interfaceSqlAstProcessingState
-
getFromClauseAccess
public FromClauseAccess getFromClauseAccess()
- Specified by:
getFromClauseAccessin interfaceSqlAstCreationState
-
getSqlAliasBaseGenerator
public SqlAliasBaseGenerator getSqlAliasBaseGenerator()
- Specified by:
getSqlAliasBaseGeneratorin interfaceSqlAstCreationState
-
getLoadQueryInfluencers
public LoadQueryInfluencers getLoadQueryInfluencers()
- Specified by:
getLoadQueryInfluencersin interfaceSqlAstCreationState
-
applyOnlyLoadByKeyFilters
public boolean applyOnlyLoadByKeyFilters()
- Specified by:
applyOnlyLoadByKeyFiltersin interfaceSqlAstCreationState
-
registerLockMode
public void registerLockMode(String identificationVariable, LockMode explicitLockMode)
- Specified by:
registerLockModein interfaceSqlAstCreationState
-
visitFetches
public ImmutableFetchList visitFetches(FetchParent fetchParent)
Description copied from interface:DomainResultCreationStateVisit 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:
visitFetchesin interfaceDomainResultCreationState
-
withNestedFetchParent
public <R> R withNestedFetchParent(FetchParent fetchParent, Function<FetchParent,R> action)
- Specified by:
withNestedFetchParentin interfaceDomainResultCreationState
-
isResolvingCircularFetch
public boolean isResolvingCircularFetch()
- Specified by:
isResolvingCircularFetchin interfaceDomainResultCreationState
-
setResolvingCircularFetch
public void setResolvingCircularFetch(boolean resolvingCircularFetch)
- Specified by:
setResolvingCircularFetchin interfaceDomainResultCreationState
-
getCurrentlyResolvingForeignKeyPart
public ForeignKeyDescriptor.Nature getCurrentlyResolvingForeignKeyPart()
Description copied from interface:DomainResultCreationStateReturns the part of the foreign key that is currently being resolved, ornullif no foreign key is currently being resolved.- Specified by:
getCurrentlyResolvingForeignKeyPartin interfaceDomainResultCreationState
-
setCurrentlyResolvingForeignKeyPart
public void setCurrentlyResolvingForeignKeyPart(ForeignKeyDescriptor.Nature currentlyResolvingForeignKeySide)
- Specified by:
setCurrentlyResolvingForeignKeyPartin interfaceDomainResultCreationState
-
forceIdentifierSelection
public boolean forceIdentifierSelection()
Description copied from interface:DomainResultCreationStateWhether forcing the selection of the identifier is in effect for this creation- Specified by:
forceIdentifierSelectionin interfaceDomainResultCreationState
-
getSqlAstCreationState
public SqlAstCreationState getSqlAstCreationState()
Description copied from interface:DomainResultCreationStateThe underlying state for SQL AST creation- Specified by:
getSqlAstCreationStatein interfaceDomainResultCreationState- Specified by:
getSqlAstCreationStatein interfaceSqlAstProcessingState
-
registerVisitedAssociationKey
public boolean registerVisitedAssociationKey(AssociationKey associationKey)
Description copied from interface:DomainResultCreationStateRegisters a circularity detection key- Specified by:
registerVisitedAssociationKeyin interfaceDomainResultCreationState
-
removeVisitedAssociationKey
public void removeVisitedAssociationKey(AssociationKey associationKey)
Description copied from interface:DomainResultCreationStateRemoves the registration of a circularity detection key- Specified by:
removeVisitedAssociationKeyin interfaceDomainResultCreationState
-
isAssociationKeyVisited
public boolean isAssociationKeyVisited(AssociationKey associationKey)
Description copied from interface:DomainResultCreationStateChecks whether the given circularityKey is registered- Specified by:
isAssociationKeyVisitedin interfaceDomainResultCreationState
-
isRegisteringVisitedAssociationKeys
public boolean isRegisteringVisitedAssociationKeys()
Description copied from interface:DomainResultCreationStateIs this state accepting circularity detection keys?- Specified by:
isRegisteringVisitedAssociationKeysin interfaceDomainResultCreationState
-
resolveModelPart
public ModelPart resolveModelPart(NavigablePath navigablePath)
Description copied from interface:DomainResultCreationStateResolve 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:
resolveModelPartin interfaceDomainResultCreationState
-
getParentState
public SqlAstProcessingState getParentState()
- Specified by:
getParentStatein interfaceSqlAstProcessingState
-
getTimeout
public Integer getTimeout()
Description copied from interface:QueryOptionsThe timeout to apply to the query. May also be defined at the transaction level usingTransaction.getTimeout()- Specified by:
getTimeoutin interfaceQueryOptions
-
getFlushMode
public FlushMode getFlushMode()
Description copied from interface:QueryOptionsThe flush mode to use for the query execution- Specified by:
getFlushModein interfaceQueryOptions
-
isReadOnly
public Boolean isReadOnly()
Description copied from interface:QueryOptionsShould entities returned from the query be marked read-only.- Specified by:
isReadOnlyin interfaceQueryOptions
-
getAppliedGraph
public AppliedGraph getAppliedGraph()
Description copied from interface:QueryOptionsJPAEntityGraphexplicitly applied to the query.- Specified by:
getAppliedGraphin interfaceQueryOptions
-
getTupleTransformer
public TupleTransformer<?> getTupleTransformer()
Description copied from interface:QueryOptionsTransformer applied to the query to transform the structure of each "row" in the results- Specified by:
getTupleTransformerin interfaceQueryOptions
-
getResultListTransformer
public ResultListTransformer<?> getResultListTransformer()
Description copied from interface:QueryOptionsTransformer applied to the query to transform the structure of the overall results- Specified by:
getResultListTransformerin interfaceQueryOptions
-
isResultCachingEnabled
public Boolean isResultCachingEnabled()
Description copied from interface:QueryOptionsShould results from the query be cached?- Specified by:
isResultCachingEnabledin interfaceQueryOptions- See Also:
QueryOptions.getCacheMode(),QueryOptions.getResultCacheRegionName()
-
getQueryPlanCachingEnabled
public Boolean getQueryPlanCachingEnabled()
Description copied from interface:QueryOptionsShould the query plan of the query be cached?- Specified by:
getQueryPlanCachingEnabledin interfaceQueryOptions
-
getCacheRetrieveMode
public CacheRetrieveMode getCacheRetrieveMode()
Description copied from interface:QueryOptionsControls whether query results are read from the cache. No effect unlessQueryOptions.isResultCachingEnabled()returnstrue- Specified by:
getCacheRetrieveModein interfaceQueryOptions- See Also:
CacheMode
-
getCacheStoreMode
public CacheStoreMode getCacheStoreMode()
Description copied from interface:QueryOptionsControls whether query results are put into the cache. No effect unlessQueryOptions.isResultCachingEnabled()returnstrue- Specified by:
getCacheStoreModein interfaceQueryOptions- See Also:
CacheMode
-
getResultCacheRegionName
public String getResultCacheRegionName()
Description copied from interface:QueryOptionsThe query cache region in which the results should be cached. No effect unlessQueryOptions.isResultCachingEnabled()returnstrue- Specified by:
getResultCacheRegionNamein interfaceQueryOptions
-
getLockOptions
public LockOptions getLockOptions()
Description copied from interface:QueryOptionsDescribes the locking to apply to the query results- Specified by:
getLockOptionsin interfaceQueryOptions
-
getComment
public String getComment()
Description copied from interface:QueryOptionsThe SQL comment to apply to the interpreted SQL query, for dialects which support SQL comments- Specified by:
getCommentin interfaceQueryOptions
-
getDatabaseHints
public List<String> getDatabaseHints()
Description copied from interface:QueryOptionsHints to apply to the interpreted SQL query- Specified by:
getDatabaseHintsin interfaceQueryOptions
-
getFetchSize
public Integer getFetchSize()
Description copied from interface:QueryOptionsThe fetch size to be applied to the JDBC query.- Specified by:
getFetchSizein interfaceQueryOptions- See Also:
Statement.getFetchSize()
-
getLimit
public Limit getLimit()
Description copied from interface:QueryOptionsThe limit to the query results. May also be accessed viaQueryOptions.getFirstRow()andQueryOptions.getMaxRows()- Specified by:
getLimitin interfaceQueryOptions
-
getEnabledFetchProfiles
public Set<String> getEnabledFetchProfiles()
Description copied from interface:QueryOptionsThe explicitly enabled profiles for this query- Specified by:
getEnabledFetchProfilesin interfaceQueryOptions
-
getDisabledFetchProfiles
public Set<String> getDisabledFetchProfiles()
Description copied from interface:QueryOptionsThe explicitly disabled profiles for this query- Specified by:
getDisabledFetchProfilesin interfaceQueryOptions
-
-