Top Description Methods
org.hibernate.boot.spi

public Interface SessionFactoryOptions

extends QueryEngineOptions
Known Direct Implementers
org.hibernate.boot.internal.SessionFactoryOptionsBuilder, org.hibernate.boot.spi.AbstractDelegatingSessionFactoryOptions
Imports
java.util.TimeZone, java.util.function.Supplier, org.hibernate.CustomEntityDirtinessStrategy, .EntityNameResolver, .Incubating, .Interceptor, .SessionFactoryObserver, .TimeZoneStorageStrategy, org.hibernate.boot.SchemaAutoTooling, .TempTableDdlTransactionHandling, org.hibernate.boot.registry.StandardServiceRegistry, org.hibernate.cache.spi.TimestampsCacheFactory, org.hibernate.context.spi.CurrentTenantIdentifierResolver, org.hibernate.engine.spi.SessionFactoryImplementor, org.hibernate.internal.BaselineSessionEventsListenerBuilder, org.hibernate.jpa.spi.JpaCompliance, org.hibernate.loader.BatchFetchStyle, org.hibernate.proxy.EntityNotFoundDelegate, org.hibernate.query.ImmutableEntityUpdateQueryHandlingMode, .NullPrecedence, org.hibernate.query.criteria.ValueHandlingMode, org.hibernate.query.spi.QueryEngineOptions, org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode, .StatementInspector, org.hibernate.stat.Statistics, org.hibernate.type.descriptor.java.JavaType, .ObjectJavaType, org.hibernate.type.format.FormatMapper

Aggregator of special options used to build the org.hibernate.SessionFactory.
Since
5.0

Method Summary

Modifier and TypeMethod and Description
public default boolean
public default boolean
public BaselineSessionEventsListenerBuilder
public BatchFetchStyle
getBatchFetchStyle()

Deprecated since 6.0. : No longer used internally
public Object
public String
public default ValueHandlingMode
public CurrentTenantIdentifierResolver<Object>
public CustomEntityDirtinessStrategy
public int
public default String

Returns:

The default catalog to use.
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).

public NullPrecedence
public default String

Returns:

The default schema to use.
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).

public default JavaType<Object>
getDefaultTenantIdentifierJavaType()

The default tenant identifier java type to use, in case no explicit tenant identifier property is defined.

public TimeZoneStorageStrategy
public EntityNameResolver[]
public EntityNotFoundDelegate

Returns:

The specific EntityNotFoundDelegate to use, May be null
getEntityNotFoundDelegate
()

Get the delegate for handling entity-not-found exception conditions.

public default ImmutableEntityUpdateQueryHandlingMode
public Interceptor

Returns:

The interceptor to use factory wide. May be null
getInterceptor
()

Get the interceptor to use by default for all sessions opened from this factory.

public int
public Integer
public TimeZone
public JpaCompliance
public FormatMapper
getJsonFormatMapper()

The format mapper to use for serializing/deserializing JSON data.

public Integer
public default boolean
public PhysicalConnectionHandlingMode
public int
public int
public int
public int
public int
public default int
public SchemaAutoTooling
public StandardServiceRegistry

Returns:

The service registry to use.
getServiceRegistry
()

The service registry to use in building the factory.

public String

Returns:

The SessionFactory name
getSessionFactoryName
()

The name to be used for the SessionFactory.

public SessionFactoryObserver[]
public Supplier<? extends Interceptor>

Returns:

The interceptor to use factory wide. May be null
getStatelessInterceptorImplementorSupplier
()

Get the interceptor to use by default for all sessions opened from this factory.

public StatementInspector
public TempTableDdlTransactionHandling
public TimestampsCacheFactory
public String

Returns:

The UUID for this SessionFactory.
getUuid
()

Get the UUID unique to this SessionFactoryOptions.

public Object
public FormatMapper
getXmlFormatMapper()

The format mapper to use for serializing/deserializing XML data.

public default boolean
public boolean
public default boolean
public boolean
public boolean
public boolean
public default boolean
public boolean
public default boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean

Returns:

true indicates the SessionFactory was built through JPA bootstrapping; false indicates it was built through native bootstrapping.
isJpaBootstrap
()

Was building of the SessionFactory initiated through JPA bootstrapping, or through Hibernate's native bootstrapping?

public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean
public boolean

Returns:

true if the SessionFactory name is also a JNDI name; false otherwise.
isSessionFactoryNameAlsoJndiName
()

Is the SesssionFactory name also a JNDI name, indicating we should bind it into JNDI?

public boolean
public boolean
public boolean
public boolean

Returns:

true indicates we should try to use java.sql.CallableStatement named parameters, if the Dialect says it is supported; false indicates that we should never try to use java.sql.CallableStatement named parameters, regardless of what the Dialect says.
isUseOfJdbcNamedParametersEnabled
()

Controls whether Hibernate should try to map named parameter names specified in a org.hibernate.procedure.ProcedureCall or jakarta.persistence.StoredProcedureQuery to named parameters in the JDBC java.sql.CallableStatement.

public void
setCheckNullability(boolean enabled)

Inherited from org.hibernate.query.spi.QueryEngineOptions:
getCustomHqlTranslatorgetCustomSqlFunctionMapgetCustomSqmFunctionRegistrygetCustomSqmMultiTableInsertStrategygetCustomSqmMultiTableMutationStrategygetCustomSqmTranslatorFactory

Method Detail

areJPACallbacksEnabledback to summary
public default boolean areJPACallbacksEnabled()
doesConnectionProviderDisableAutoCommitback to summary
public default boolean doesConnectionProviderDisableAutoCommit()
getBaselineSessionEventsListenerBuilderback to summary
public BaselineSessionEventsListenerBuilder getBaselineSessionEventsListenerBuilder()
getBatchFetchStyleback to summary
public BatchFetchStyle getBatchFetchStyle()

Deprecated

since 6.0.

: No longer used internally

Annotations
@Deprecated
since:6.0
getBeanManagerReferenceback to summary
public Object getBeanManagerReference()
getCacheRegionPrefixback to summary
public String getCacheRegionPrefix()
getCriteriaValueHandlingModeback to summary
public default ValueHandlingMode getCriteriaValueHandlingMode()

Implements org.hibernate.query.spi.QueryEngineOptions.getCriteriaValueHandlingMode.

See Also
org.hibernate.cfg.AvailableSettings#CRITERIA_VALUE_HANDLING_MODE
getCurrentTenantIdentifierResolverback to summary
public CurrentTenantIdentifierResolver<Object> getCurrentTenantIdentifierResolver()
getCustomEntityDirtinessStrategyback to summary
public CustomEntityDirtinessStrategy getCustomEntityDirtinessStrategy()
getDefaultBatchFetchSizeback to summary
public int getDefaultBatchFetchSize()
getDefaultCatalogback to summary
public default String 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:String

The default catalog to use.

getDefaultNullPrecedenceback to summary
public NullPrecedence getDefaultNullPrecedence()
getDefaultSchemaback to summary
public default String 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:String

The default schema to use.

getDefaultTenantIdentifierJavaTypeback to summary
public default JavaType<Object> getDefaultTenantIdentifierJavaType()

The default tenant identifier java type to use, in case no explicit tenant identifier property is defined.

Annotations
@Incubating
Since
6.4
getDefaultTimeZoneStorageStrategyback to summary
public TimeZoneStorageStrategy getDefaultTimeZoneStorageStrategy()
Annotations
@Incubating
getEntityNameResolversback to summary
public EntityNameResolver[] getEntityNameResolvers()
getEntityNotFoundDelegateback to summary
public EntityNotFoundDelegate getEntityNotFoundDelegate()

Get the delegate for handling entity-not-found exception conditions.

Returns:EntityNotFoundDelegate

The specific EntityNotFoundDelegate to use, May be null

getImmutableEntityUpdateQueryHandlingModeback to summary
public default ImmutableEntityUpdateQueryHandlingMode getImmutableEntityUpdateQueryHandlingMode()
getInterceptorback to summary
public Interceptor getInterceptor()

Get the interceptor to use by default for all sessions opened from this factory.

Returns:Interceptor

The interceptor to use factory wide. May be null

getJdbcBatchSizeback to summary
public int getJdbcBatchSize()
getJdbcFetchSizeback to summary
public Integer getJdbcFetchSize()
getJdbcTimeZoneback to summary
public TimeZone getJdbcTimeZone()
getJpaComplianceback to summary
public JpaCompliance getJpaCompliance()

Redeclares org.hibernate.query.spi.QueryEngineOptions.getJpaCompliance.

getJsonFormatMapperback to summary
public FormatMapper getJsonFormatMapper()

The format mapper to use for serializing/deserializing JSON data.

Annotations
@Incubating
Since
6.0
getMaximumFetchDepthback to summary
public Integer getMaximumFetchDepth()
getNativeJdbcParametersIgnoredback to summary
public default boolean getNativeJdbcParametersIgnored()
See Also
org.hibernate.cfg.AvailableSettings#NATIVE_IGNORE_JDBC_PARAMETERS
getPhysicalConnectionHandlingModeback to summary
public PhysicalConnectionHandlingMode getPhysicalConnectionHandlingMode()
getPreferredSqlTypeCodeForArrayback to summary
public int getPreferredSqlTypeCodeForArray()
Annotations
@Incubating
getPreferredSqlTypeCodeForBooleanback to summary
public int getPreferredSqlTypeCodeForBoolean()
Annotations
@Incubating
getPreferredSqlTypeCodeForDurationback to summary
public int getPreferredSqlTypeCodeForDuration()
Annotations
@Incubating
getPreferredSqlTypeCodeForInstantback to summary
public int getPreferredSqlTypeCodeForInstant()
Annotations
@Incubating
getPreferredSqlTypeCodeForUuidback to summary
public int getPreferredSqlTypeCodeForUuid()
Annotations
@Incubating
getQueryStatisticsMaxSizeback to summary
public default int getQueryStatisticsMaxSize()
getSchemaAutoToolingback to summary
public SchemaAutoTooling getSchemaAutoTooling()
getServiceRegistryback to summary
public StandardServiceRegistry getServiceRegistry()

The service registry to use in building the factory.

Returns:StandardServiceRegistry

The service registry to use.

getSessionFactoryNameback to summary
public String getSessionFactoryName()

The name to be used for the SessionFactory. This is used both in:

Returns:String

The SessionFactory name

getSessionFactoryObserversback to summary
public SessionFactoryObserver[] getSessionFactoryObservers()
getStatelessInterceptorImplementorSupplierback to summary
public Supplier<? extends Interceptor> getStatelessInterceptorImplementorSupplier()

Get the interceptor to use by default for all sessions opened from this factory.

Returns:Supplier<? extends Interceptor>

The interceptor to use factory wide. May be null

getStatementInspectorback to summary
public StatementInspector getStatementInspector()
getTempTableDdlTransactionHandlingback to summary
public TempTableDdlTransactionHandling getTempTableDdlTransactionHandling()
getTimestampsCacheFactoryback to summary
public TimestampsCacheFactory getTimestampsCacheFactory()
getUuidback to summary
public String getUuid()

Get the UUID unique to this SessionFactoryOptions. Will be the same value available as SessionFactoryImplementor#getUuid().

API Note

The value is generated as a java.util.UUID, but kept as a String.

Returns:String

The UUID for this SessionFactory.

See Also
org.hibernate.internal.SessionFactoryRegistry#getSessionFactory, SessionFactoryImplementor#getUuid
getValidatorFactoryReferenceback to summary
public Object getValidatorFactoryReference()
getXmlFormatMapperback to summary
public FormatMapper getXmlFormatMapper()

The format mapper to use for serializing/deserializing XML data.

Annotations
@Incubating
Since
6.0.1
inClauseParameterPaddingEnabledback to summary
public default boolean inClauseParameterPaddingEnabled()
isAllowOutOfTransactionUpdateOperationsback to summary
public boolean isAllowOutOfTransactionUpdateOperations()
isAllowRefreshDetachedEntityback to summary
public default boolean isAllowRefreshDetachedEntity()
isAutoCloseSessionEnabledback to summary
public boolean isAutoCloseSessionEnabled()
isAutoEvictCollectionCacheback to summary
public boolean isAutoEvictCollectionCache()
isCheckNullabilityback to summary
public boolean isCheckNullability()
isCollectionsInDefaultFetchGroupEnabledback to summary
public default boolean isCollectionsInDefaultFetchGroupEnabled()
isCommentsEnabledback to summary
public boolean isCommentsEnabled()
isCriteriaCopyTreeEnabledback to summary
public default boolean isCriteriaCopyTreeEnabled()
See Also
org.hibernate.cfg.AvailableSettings#CRITERIA_COPY_TREE
isDelayBatchFetchLoaderCreationsEnabledback to summary
public boolean isDelayBatchFetchLoaderCreationsEnabled()
isDirectReferenceCacheEntriesEnabledback to summary
public boolean isDirectReferenceCacheEntriesEnabled()
isFailOnPaginationOverCollectionFetchEnabledback to summary
public boolean isFailOnPaginationOverCollectionFetchEnabled()
isFlushBeforeCompletionEnabledback to summary
public boolean isFlushBeforeCompletionEnabled()
isGetGeneratedKeysEnabledback to summary
public boolean isGetGeneratedKeysEnabled()
isIdentifierRollbackEnabledback to summary
public boolean isIdentifierRollbackEnabled()
isInitializeLazyStateOutsideTransactionsEnabledback to summary
public boolean isInitializeLazyStateOutsideTransactionsEnabled()
isJdbcBatchVersionedDataback to summary
public boolean isJdbcBatchVersionedData()
isJpaBootstrapback to summary
public boolean isJpaBootstrap()

Was building of the SessionFactory initiated through JPA bootstrapping, or through Hibernate's native bootstrapping?

Returns:boolean

true indicates the SessionFactory was built through JPA bootstrapping; false indicates it was built through native bootstrapping.

isJtaTrackByThreadback to summary
public boolean isJtaTrackByThread()
isJtaTransactionAccessEnabledback to summary
public boolean isJtaTransactionAccessEnabled()
isMinimalPutsEnabledback to summary
public boolean isMinimalPutsEnabled()
isMultiTenancyEnabledback to summary
public boolean isMultiTenancyEnabled()
isNamedQueryStartupCheckingEnabledback to summary
public boolean isNamedQueryStartupCheckingEnabled()
isOrderInsertsEnabledback to summary
public boolean isOrderInsertsEnabled()
isOrderUpdatesEnabledback to summary
public boolean isOrderUpdatesEnabled()
isPreferUserTransactionback to summary
public boolean isPreferUserTransaction()
isQueryCacheEnabledback to summary
public boolean isQueryCacheEnabled()
isReleaseResourcesOnCloseEnabledback to summary
public boolean isReleaseResourcesOnCloseEnabled()
isScrollableResultSetsEnabledback to summary
public boolean isScrollableResultSetsEnabled()
isSecondLevelCacheEnabledback to summary
public boolean isSecondLevelCacheEnabled()
isSessionFactoryNameAlsoJndiNameback to summary
public boolean isSessionFactoryNameAlsoJndiName()

Is the SesssionFactory name also a JNDI name, indicating we should bind it into JNDI?

Returns:boolean

true if the SessionFactory name is also a JNDI name; false otherwise.

isStatisticsEnabledback to summary
public boolean isStatisticsEnabled()
isStructuredCacheEntriesEnabledback to summary
public boolean isStructuredCacheEntriesEnabled()
isSubselectFetchEnabledback to summary
public boolean isSubselectFetchEnabled()
isUseOfJdbcNamedParametersEnabledback to summary
public boolean isUseOfJdbcNamedParametersEnabled()

Controls whether Hibernate should try to map named parameter names specified in a org.hibernate.procedure.ProcedureCall or jakarta.persistence.StoredProcedureQuery to named parameters in the JDBC java.sql.CallableStatement.

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 to false simply circumvents that check and always performs positional binding.

Returns:boolean

true indicates we should try to use java.sql.CallableStatement named parameters, if the Dialect says it is supported; false indicates that we should never try to use java.sql.CallableStatement named parameters, regardless of what the Dialect says.

See Also
org.hibernate.cfg.AvailableSettings#CALLABLE_NAMED_PARAMS_ENABLED
setCheckNullabilityback to summary
public void setCheckNullability(boolean enabled)