Package org.hibernate.boot.spi
Interface SessionFactoryOptions
- All Superinterfaces:
QueryEngineOptions
- All Known Implementing Classes:
AbstractDelegatingSessionFactoryOptions,SessionFactoryOptionsBuilder
Aggregator of special options used to build the
SessionFactory.- Since:
- 5.0
- See Also:
- API Note:
- This type belongs to an SPI package. Due to a historical mistake, it is exposed
via the deprecated method
SessionFactory.getSessionFactoryOptions().
-
Method Summary
Modifier and TypeMethodDescriptionbooleanShould JPA entity lifecycle callbacks be processed by theEventEngineandCallbackRegistry?default SessionEventListener[]Build an array of baselineSessionEventListeners.booleanDo newly-obtained JDBC connections come with autocommit already disabled?Deprecated, for removal: This API element is subject to removal in a future version.This operation is a layer-breaker, exposing an internal type.A factory-specific prefix to be applied to all cache region names.getCacheRetrieveMode(Map<String, Object> properties) Determine the defaultCacheRetrieveMode, given the current session properties.getCacheStoreMode(Map<String, Object> properties) Determine the defaultCacheStoreMode, given the current session properties.Obtain a reference to the current tenant identifier resolver, if any, or returnnullis there is no resolver configured.A custom strategy for determining if an entity instance is dirty.intThe default batch size for batch fetching in new sessions.default StringThe default catalog to use in generated SQL when a catalog wasn't specified in the mapping, neither explicitly nor implicitly (see the concept of implicit catalog in XML mapping).The default lock scope and lock timeout.The default precedence of null values in sorted query results.default StringThe default schema to use in generated SQL when a catalog wasn't specified in the mapping, neither explicitly nor implicitly (see the concept of implicit schema in XML mapping).Default properties for brand-new sessions.The default tenant identifier java type to use, in case no explicit tenant identifier property is defined.An array of custom entity name resolvers.Get the delegate for handling entity-not-found exception conditions.The default initialCacheModefor new sessions.The default initialFlushModefor new sessions.An interceptor instance shared between all sessions created by this factory.intThe default JDBC statement batch size for new sessions.The timezone to use when interacting with JDBC.The format mapper to use for serializing/deserializing JSON data.default booleanintintintintintThe layout of entries in the query cache.intThe number ofQueryStatisticsentries that should be stored byStatistics.Deprecated, for removal: This API element is subject to removal in a future version.This is unused and will be removed.The service registry to use in building the factory.The name to be used for theSessionFactory.Observers for events raised by the factory.Supplier<? extends Interceptor>A statelessSupplierfor interceptor instances which are not shared between sessions created by this factory.The defaultStatementInspectorfor this factory.Deprecated, for removal: This API element is subject to removal in a future version.A factory for theTimestampsCacheused to track invalidation of cached query result sets.getUuid()Get the UUID unique to this SessionFactoryOptions.The format mapper to use for serializing/deserializing XML data.default booleanbooleandefault booleanDeprecated, for removal: This API element is subject to removal in a future version.with no replacement.booleanbooleanbooleanShould Hibernate validate that non-optional attributes have non-null values?default booleanbooleanShould explanatory comment text be added to the generated SQL?default booleandefault booleanbooleanDeprecated, for removal: This API element is subject to removal in a future version.This is no longer usedbooleanbooleanbooleanbooleanbooleanShould generated identifiers be reset after entity removal?booleanAre detached proxies and collections fetched in a temporary persistence context?booleanWas building of theSessionFactoryinitiated through JPA bootstrapping, or through Hibernate-native bootstrapping?booleanbooleanbooleanShould we avoid overwriting cache entries with identical entries?booleanIs there a multi-tenant connection provider configured?booleanAre named queries validated when the factory is created?booleanbooleanbooleanbooleanbooleanShould native queries return JDBC datetime types instead of usingjava.timetypes.booleanbooleanbooleanIs the query cache enabled?booleanDeprecated, for removal: This API element is subject to removal in a future version.since "hibernate.discard_pc_on_close" is deprecatedbooleanbooleanIs the second-level cache enabled?Is the session factory name also a JNDI name, indicating we should bind it into JNDI?booleanIs collection of statistics enabled by default for this factory?booleanAre second-level cache entries stored in a human-readable format.booleanIs subselect fetching enabled by default in new sessions?booleanbooleanControls whether Hibernate should try to map named parameter names specified in aProcedureCallorStoredProcedureQueryto named parameters in the JDBCCallableStatement.booleanWhether to use the legacy format for serializing/deserializing XML data.voidsetCheckNullability(boolean enabled) Allows Bean Validation to disable null checking.Methods inherited from interface org.hibernate.query.spi.QueryEngineOptions
allowImmutableEntityUpdate, getCriteriaValueHandlingMode, getCustomHqlTranslator, getCustomSqlFunctionMap, getCustomSqmFunctionRegistry, getCustomSqmMultiTableInsertStrategy, getCustomSqmMultiTableMutationStrategy, getCustomSqmTranslatorFactory, getImmutableEntityUpdateQueryHandlingMode, isJsonFunctionsEnabled, isPortableIntegerDivisionEnabled, isXmlFunctionsEnabled
-
Method Details
-
getUuid
String getUuid()Get the UUID unique to this SessionFactoryOptions. Will be the same value available asSessionFactoryImplementor.getUuid().- Specified by:
getUuidin interfaceQueryEngineOptions- Returns:
- The UUID for this SessionFactory.
- See Also:
- API Note:
- The value is generated as a
UUID, but kept as a String.
-
getServiceRegistry
StandardServiceRegistry getServiceRegistry()The service registry to use in building the factory.- Returns:
- The service registry to use.
-
getBeanManagerReference
Object getBeanManagerReference() -
getValidatorFactoryReference
Object getValidatorFactoryReference() -
getJpaCompliance
JpaCompliance getJpaCompliance()- Specified by:
getJpaCompliancein interfaceQueryEngineOptions- See Also:
-
isJpaBootstrap
boolean isJpaBootstrap()Was building of theSessionFactoryinitiated through JPA bootstrapping, or through Hibernate-native bootstrapping?- Returns:
trueindicates the SessionFactory was built through JPA bootstrapping;falseindicates it was built through native bootstrapping.
-
isAllowRefreshDetachedEntity
Deprecated, for removal: This API element is subject to removal in a future version.with no replacement. -
getSessionFactoryName
String getSessionFactoryName()The name to be used for theSessionFactory. This is used during in-VM serialization; seeSessionFactoryRegistry. May also be used as a JNDI name, depending on "hibernate.session_factory_jndi_name" and "hibernate.session_factory_name_is_jndi".- Specified by:
getSessionFactoryNamein interfaceQueryEngineOptions- Returns:
- The session factory name
- See Also:
-
isSessionFactoryNameAlsoJndiName
Boolean isSessionFactoryNameAlsoJndiName()Is the session factory name also a JNDI name, indicating we should bind it into JNDI?- Returns:
trueif the SessionFactory name is also a JNDI name;falseotherwise.- See Also:
-
isStatisticsEnabled
boolean isStatisticsEnabled()Is collection of statistics enabled by default for this factory? -
getInterceptor
Interceptor getInterceptor()An interceptor instance shared between all sessions created by this factory. Such an interceptor must be thread-safe and may not hold state associated with any given session.- Returns:
- The interceptor instance to use factory-wide by default. May be
null. - See Also:
-
getStatelessInterceptorImplementorSupplier
Supplier<? extends Interceptor> getStatelessInterceptorImplementorSupplier()A statelessSupplierfor interceptor instances which are not shared between sessions created by this factory. This allows eachInterceptorinstances itself to hold state associated with its session.- Returns:
- The interceptor supplier to use by default. May be
null. - See Also:
-
getStatementInspector
StatementInspector getStatementInspector()The defaultStatementInspectorfor this factory. -
getSessionFactoryObservers
SessionFactoryObserver[] getSessionFactoryObservers()Observers for events raised by the factory. -
getBaselineSessionEventsListenerBuilder
@Deprecated(since="7.0", forRemoval=true) BaselineSessionEventsListenerBuilder getBaselineSessionEventsListenerBuilder()Deprecated, for removal: This API element is subject to removal in a future version.This operation is a layer-breaker, exposing an internal type. It will be removed. UsebuildSessionEventListeners()instead. -
buildSessionEventListeners
Build an array of baselineSessionEventListeners.- Since:
- 7.0
- See Also:
-
isIdentifierRollbackEnabled
boolean isIdentifierRollbackEnabled()Should generated identifiers be reset after entity removal? -
isCheckNullability
boolean isCheckNullability()Should Hibernate validate that non-optional attributes have non-null values?- See Also:
-
setCheckNullability
Allows Bean Validation to disable null checking.- API Note:
- It's quite ugly to have a setter method on this SPI. This operation is for internal use by Bean Validation integration logic.
-
isInitializeLazyStateOutsideTransactionsEnabled
boolean isInitializeLazyStateOutsideTransactionsEnabled()Are detached proxies and collections fetched in a temporary persistence context?- See Also:
- API Note:
- The naming here is very misleading. This behavior has little to do with transactions.
-
getTempTableDdlTransactionHandling
@Deprecated(since="7.0", forRemoval=true) TempTableDdlTransactionHandling getTempTableDdlTransactionHandling()Deprecated, for removal: This API element is subject to removal in a future version.This is unused and will be removed. -
isDelayBatchFetchLoaderCreationsEnabled
Deprecated, for removal: This API element is subject to removal in a future version.This is no longer used -
getDefaultBatchFetchSize
int getDefaultBatchFetchSize()The default batch size for batch fetching in new sessions. -
getMaximumFetchDepth
Integer getMaximumFetchDepth()- See Also:
-
isSubselectFetchEnabled
boolean isSubselectFetchEnabled()Is subselect fetching enabled by default in new sessions? -
getDefaultNullPrecedence
Nulls getDefaultNullPrecedence()The default precedence of null values in sorted query results.- See Also:
-
isOrderUpdatesEnabled
boolean isOrderUpdatesEnabled()- See Also:
-
isOrderInsertsEnabled
boolean isOrderInsertsEnabled()- See Also:
-
isMultiTenancyEnabled
boolean isMultiTenancyEnabled()Is there a multi-tenant connection provider configured? -
getCurrentTenantIdentifierResolver
CurrentTenantIdentifierResolver<Object> getCurrentTenantIdentifierResolver()Obtain a reference to the current tenant identifier resolver, if any, or returnnullis there is no resolver configured. -
isJtaTrackByThread
boolean isJtaTrackByThread()- See Also:
-
isNamedQueryStartupCheckingEnabled
boolean isNamedQueryStartupCheckingEnabled()Are named queries validated when the factory is created?- See Also:
-
isSecondLevelCacheEnabled
boolean isSecondLevelCacheEnabled()Is the second-level cache enabled?- See Also:
-
isQueryCacheEnabled
boolean isQueryCacheEnabled()Is the query cache enabled?- See Also:
-
getQueryCacheLayout
The layout of entries in the query cache.- See Also:
-
getTimestampsCacheFactory
TimestampsCacheFactory getTimestampsCacheFactory()A factory for theTimestampsCacheused to track invalidation of cached query result sets.- See Also:
-
getCacheRegionPrefix
String getCacheRegionPrefix()A factory-specific prefix to be applied to all cache region names.- See Also:
-
isMinimalPutsEnabled
boolean isMinimalPutsEnabled()Should we avoid overwriting cache entries with identical entries?This is useful if cache writes are much more expensive than cache reads.
- See Also:
- API Note:
- This is currently unused.
-
isStructuredCacheEntriesEnabled
boolean isStructuredCacheEntriesEnabled()Are second-level cache entries stored in a human-readable format.- See Also:
-
isDirectReferenceCacheEntriesEnabled
boolean isDirectReferenceCacheEntriesEnabled() -
isAutoEvictCollectionCache
boolean isAutoEvictCollectionCache() -
getSchemaAutoTooling
Deprecated, for removal: This API element is subject to removal in a future version.This is unused and will be removed.- See Also:
-
getJdbcBatchSize
int getJdbcBatchSize()The default JDBC statement batch size for new sessions. -
isScrollableResultSetsEnabled
boolean isScrollableResultSetsEnabled()- See Also:
-
isGetGeneratedKeysEnabled
boolean isGetGeneratedKeysEnabled()- See Also:
-
getJdbcFetchSize
Integer getJdbcFetchSize()- See Also:
-
getPhysicalConnectionHandlingMode
PhysicalConnectionHandlingMode getPhysicalConnectionHandlingMode() -
doesConnectionProviderDisableAutoCommit
boolean doesConnectionProviderDisableAutoCommit()Do newly-obtained JDBC connections come with autocommit already disabled? -
isCommentsEnabled
boolean isCommentsEnabled()Should explanatory comment text be added to the generated SQL?- See Also:
-
getCustomEntityDirtinessStrategy
CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy()A custom strategy for determining if an entity instance is dirty. -
getEntityNameResolvers
EntityNameResolver[] getEntityNameResolvers()An array of custom entity name resolvers. -
getEntityNotFoundDelegate
EntityNotFoundDelegate getEntityNotFoundDelegate()Get the delegate for handling entity-not-found exception conditions.Returns
StandardEntityNotFoundDelegateby default.- Returns:
- The specific
EntityNotFoundDelegateto use, may benull - See Also:
-
isFlushBeforeCompletionEnabled
boolean isFlushBeforeCompletionEnabled() -
isAutoCloseSessionEnabled
boolean isAutoCloseSessionEnabled()- See Also:
-
isJtaTransactionAccessEnabled
boolean isJtaTransactionAccessEnabled() -
isPreferUserTransaction
boolean isPreferUserTransaction() -
isAllowOutOfTransactionUpdateOperations
boolean isAllowOutOfTransactionUpdateOperations() -
isReleaseResourcesOnCloseEnabled
Deprecated, for removal: This API element is subject to removal in a future version.since "hibernate.discard_pc_on_close" is deprecated- See Also:
-
getJdbcTimeZone
TimeZone getJdbcTimeZone()The timezone to use when interacting with JDBC. -
isCriteriaCopyTreeEnabled
default boolean isCriteriaCopyTreeEnabled()- See Also:
-
isCriteriaPlanCacheEnabled
default boolean isCriteriaPlanCacheEnabled() -
getNativeJdbcParametersIgnored
default boolean getNativeJdbcParametersIgnored() -
isFailOnPaginationOverCollectionFetchEnabled
boolean isFailOnPaginationOverCollectionFetchEnabled() -
getDefaultCatalog
The default catalog to use in generated SQL when a catalog wasn't specified in the mapping, neither explicitly nor implicitly (see the concept of implicit catalog in XML mapping).- Returns:
- The default catalog to use.
- See Also:
-
getDefaultSchema
The default schema to use in generated SQL when a catalog wasn't specified in the mapping, neither explicitly nor implicitly (see the concept of implicit schema in XML mapping).- Returns:
- The default schema to use.
- See Also:
-
inClauseParameterPaddingEnabled
default boolean inClauseParameterPaddingEnabled() -
getQueryStatisticsMaxSize
int getQueryStatisticsMaxSize()The number ofQueryStatisticsentries that should be stored byStatistics. -
areJPACallbacksEnabled
boolean areJPACallbacksEnabled()Should JPA entity lifecycle callbacks be processed by theEventEngineandCallbackRegistry? -
isUseOfJdbcNamedParametersEnabled
boolean isUseOfJdbcNamedParametersEnabled()Controls whether Hibernate should try to map named parameter names specified in aProcedureCallorStoredProcedureQueryto named parameters in the JDBCCallableStatement.As JPA is defined, the use of named parameters is essentially of dubious value since by spec the parameters have to be defined in the order they are defined in the procedure/function declaration - we can always bind them positionally. The whole idea of named parameters for CallableStatement is the ability to bind these in any order, but since we unequivocally know the order anyway binding them via name really gains nothing.
If this is
true, we still need to make sure the Dialect supports named binding. Setting this tofalsesimply circumvents that check and always performs positional binding.- Returns:
trueindicates we should try to useCallableStatementnamed parameters, if the Dialect says it is supported;falseindicates that we should never try to useCallableStatementnamed parameters, regardless of what the Dialect says.- See Also:
-
isCollectionsInDefaultFetchGroupEnabled
default boolean isCollectionsInDefaultFetchGroupEnabled() -
isUnownedAssociationTransientCheck
boolean isUnownedAssociationTransientCheck() -
getPreferredSqlTypeCodeForBoolean
-
getPreferredSqlTypeCodeForDuration
-
getPreferredSqlTypeCodeForUuid
- See Also:
-
getPreferredSqlTypeCodeForInstant
-
getPreferredSqlTypeCodeForArray
-
getDefaultTimeZoneStorageStrategy
- See Also:
-
isPreferJavaTimeJdbcTypesEnabled
boolean isPreferJavaTimeJdbcTypesEnabled() -
isPreferNativeEnumTypesEnabled
boolean isPreferNativeEnumTypesEnabled()- See Also:
-
getJsonFormatMapper
The format mapper to use for serializing/deserializing JSON data.- Since:
- 6.0
- See Also:
-
getXmlFormatMapper
The format mapper to use for serializing/deserializing XML data.- Since:
- 6.0.1
- See Also:
-
isXmlFormatMapperLegacyFormatEnabled
Whether to use the legacy format for serializing/deserializing XML data.- Since:
- 7.0
- See Also:
-
getDefaultTenantIdentifierJavaType
The default tenant identifier java type to use, in case no explicit tenant identifier property is defined.- Since:
- 6.4
-
isPassProcedureParameterNames
boolean isPassProcedureParameterNames() -
isPreferJdbcDatetimeTypesInNativeQueriesEnabled
boolean isPreferJdbcDatetimeTypesInNativeQueriesEnabled()Should native queries return JDBC datetime types instead of usingjava.timetypes.- Since:
- 7.0
- See Also:
-
getCacheStoreMode
Determine the defaultCacheStoreMode, given the current session properties.- Parameters:
properties- the Session properties- Returns:
- either the
CacheStoreModeas defined in the session-specific properties, or as defined in the properties shared across all sessions (the defaults).
-
getCacheRetrieveMode
Determine the defaultCacheRetrieveMode, given the current session properties.- Parameters:
properties- the Session properties- Returns:
- either the
CacheRetrieveModeas defined in the session-specific properties, or as defined in the properties shared across all sessions (the defaults).
-
getInitialSessionCacheMode
CacheMode getInitialSessionCacheMode()The default initialCacheModefor new sessions. -
getInitialSessionFlushMode
FlushMode getInitialSessionFlushMode()The default initialFlushModefor new sessions. -
getDefaultLockOptions
LockOptions getDefaultLockOptions()The default lock scope and lock timeout. -
getDefaultSessionProperties
Default properties for brand-new sessions.- See Also:
-