T - The type of a specific sub-class; Allows sub-classes to narrow down the return-type of the contract methods
to a specialization of SessionFactoryBuilderpublic abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionFactoryBuilder> extends Object implements SessionFactoryBuilder
Convenience base class for custom implementors of SessionFactoryBuilder, using delegation
| Constructor and Description |
|---|
AbstractDelegatingSessionFactoryBuilder(SessionFactoryBuilder delegate) |
| Modifier and Type | Method and Description |
|---|---|
T |
addEntityNameResolver(EntityNameResolver... entityNameResolvers)
Specifies one or more entity name resolvers to be applied to the SessionFactory (see the
EntityNameResolver
contract for more information.. |
T |
addSessionFactoryObservers(SessionFactoryObserver... observers)
Specifies one or more observers to be applied to the SessionFactory.
|
T |
allowOutOfTransactionUpdateOperations(boolean allow) |
T |
applyAutoClosing(boolean enabled)
Applies whether Sessions should be automatically closed at the end of the transaction.
|
T |
applyAutoFlushing(boolean enabled)
Applies whether Sessions should be automatically flushed at the end of the transaction.
|
T |
applyAutomaticEvictionOfCollectionCaches(boolean enabled)
When using bi-directional many-to-one associations and caching the one-to-many side
it is expected that both sides of the association are managed (actually that is true of
all bi-directional associations).
|
T |
applyBatchFetchStyle(BatchFetchStyle style)
What style of batching should be used?
|
T |
applyBeanManager(Object beanManager)
Apply a CDI BeanManager to the SessionFactory being built.
|
T |
applyCacheRegionPrefix(String prefix)
Apply a prefix to prepended to all cache region names for this SessionFactory.
|
T |
applyConnectionHandlingMode(PhysicalConnectionHandlingMode connectionHandlingMode)
Apply the specified handling mode for JDBC connections
|
SessionFactoryBuilder |
applyConnectionProviderDisablesAutoCommit(boolean providerDisablesAutoCommit) |
T |
applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
Apply a ConnectionReleaseMode.
|
T |
applyCurrentTenantIdentifierResolver(CurrentTenantIdentifierResolver resolver)
Specifies a strategy for resolving the notion of a "current" tenant-identifier when using multi-tenancy
together with current sessions
|
T |
applyCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy strategy)
Specifies a custom entity dirtiness strategy to be applied to the SessionFactory.
|
T |
applyDefaultBatchFetchSize(int size)
Allows specifying a default batch-fetch size for all entities and collections
which do not otherwise specify a batch-fetch size.
|
T |
applyDefaultEntityMode(EntityMode entityMode)
Applies the given entity mode as the default for the SessionFactory.
|
T |
applyDefaultNullPrecedence(NullPrecedence nullPrecedence)
Apply a null precedence (NULLS FIRST, NULLS LAST) to be applied order-by clauses rendered into
SQL queries.
|
SessionFactoryBuilder |
applyDelayedEntityLoaderCreations(boolean delay)
Should entity Loaders be generated immediately? Or should the creation
be delayed until first need?
|
T |
applyDirectReferenceCaching(boolean enabled)
Generally, Hibernate will extract the information from an entity and put that
extracted information into the second-level cache.
|
T |
applyEntityNotFoundDelegate(EntityNotFoundDelegate entityNotFoundDelegate)
Names the
EntityNotFoundDelegate to be applied to the SessionFactory. |
T |
applyEntityTuplizer(EntityMode entityMode,
Class<? extends EntityTuplizer> tuplizerClass)
Register the default
EntityTuplizer to be applied to the SessionFactory. |
T |
applyEntityTuplizerFactory(EntityTuplizerFactory entityTuplizerFactory)
Specify the EntityTuplizerFactory to use.
|
T |
applyGetGeneratedKeysSupport(boolean enabled)
Should JDBC
Statement.getGeneratedKeys() feature be used for
retrieval of insert-generated ids? |
T |
applyIdentifierRollbackSupport(boolean enabled)
Should generated identifiers be "unset" on entities during a rollback?
|
T |
applyInterceptor(Interceptor interceptor)
Names an interceptor to be applied to the SessionFactory, which in turn means it will be used by all
Sessions unless one is explicitly specified in
SessionBuilder.interceptor(org.hibernate.Interceptor) |
T |
applyJdbcBatchingForVersionedEntities(boolean enabled)
This setting controls whether versioned entities will be included in JDBC batching.
|
T |
applyJdbcBatchSize(int size)
Specifies the maximum number of statements to batch together in a JDBC batch for
insert, update and delete operations.
|
T |
applyJdbcFetchSize(int size)
Apply a fetch size to the JDBC driver for fetching results.
|
T |
applyJtaTrackingByThread(boolean enabled)
If using the built-in Hibernate JTA-based TransactionCoordinator/Builder, should it track JTA
transactions by thread in an attempt to detect timeouts?
|
T |
applyLazyInitializationOutsideTransaction(boolean enabled)
Should the application be allowed to initialize uninitialized lazy state outside the bounds of a transaction?
|
T |
applyMaximumFetchDepth(int depth)
Apply a limit to the depth Hibernate will use for outer joins.
|
T |
applyMinimalPutsForCaching(boolean enabled)
By default, Hibernate will always just push data into the cache without first checking
if that data already exists.
|
T |
applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy)
How should updates and deletes that span multiple tables be handled?
|
T |
applyMultiTenancyStrategy(MultiTenancyStrategy strategy)
Apply the form of multi-tenancy used by the application
|
T |
applyName(String sessionFactoryName)
Applies a SessionFactory name.
|
T |
applyNameAsJndiName(boolean isJndiName)
Applies a SessionFactory name.
|
T |
applyNamedQueryCheckingOnStartup(boolean enabled)
Should named queries be checked on startup?
|
T |
applyNullabilityChecking(boolean enabled)
Should attributes using columns marked as not-null be checked (by Hibernate) for nullness?
|
T |
applyOrderingOfInserts(boolean enabled)
Apply whether ordering of inserts should be enabled.
|
T |
applyOrderingOfUpdates(boolean enabled)
Apply whether ordering of updates should be enabled.
|
T |
applyPreferUserTransactions(boolean preferUserTransactions)
If using the built-in Hibernate JTA-based TransactionCoordinator/Builder, should it prefer to use
UserTransaction over Transaction? |
T |
applyQueryCacheSupport(boolean enabled)
Should second level query caching support be enabled?
|
T |
applyQuerySubstitutions(Map substitutions)
Apply query substitutions to use in HQL queries.
|
T |
applyResultSetsWrapping(boolean enabled)
Hibernate currently accesses results from the JDBC ResultSet by name.
|
T |
applyScrollableResultsSupport(boolean enabled)
Should scrollable results be supported in queries? We ask the JDBC driver whether it
supports scrollable result sets as the default for this setting, but some drivers do not
accurately report this via DatabaseMetaData.
|
T |
applySecondLevelCacheSupport(boolean enabled)
Should second level caching support be enabled?
|
T |
applySqlComments(boolean enabled)
Should Hibernate apply comments to SQL it generates?
|
T |
applySqlFunction(String registrationName,
SQLFunction sqlFunction)
Apply a SQLFunction to the underlying
SQLFunctionRegistry. |
T |
applyStatelessInterceptor(Class<? extends Interceptor> statelessInterceptorClass)
Names an interceptor Class to be applied to the SessionFactory, which in turn means it will be used by all
Sessions unless one is explicitly specified in
SessionBuilder.interceptor(org.hibernate.Interceptor) |
T |
applyStatelessInterceptor(Supplier<? extends Interceptor> statelessInterceptorSupplier)
Names a
Supplier instance which is used to retrieve the interceptor to be applied to the SessionFactory,
which in turn means it will be used by all Sessions unless one is explicitly specified in
SessionBuilder.interceptor(org.hibernate.Interceptor) |
T |
applyStatementInspector(StatementInspector statementInspector)
Names a StatementInspector to be applied to the SessionFactory, which in turn means it will be used by all
Sessions unless one is explicitly specified in
SessionBuilder.statementInspector(org.hibernate.resource.jdbc.spi.StatementInspector) |
T |
applyStatisticsSupport(boolean enabled)
Applies whether statistics gathering is enabled.
|
T |
applyStrictJpaQueryLanguageCompliance(boolean enabled)
Should we strictly adhere to JPA Query Language (JPQL) syntax, or more broadly support
all of Hibernate’s superset (HQL)?
<p/>
Setting this to
true may cause valid HQL to throw an exception because it violates
the JPQL subset. |
T |
applyStructuredCacheEntries(boolean enabled)
By default, Hibernate stores data in the cache in its own optimized format.
|
T |
applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling) |
SessionFactoryBuilder |
applyTimestampsCacheFactory(TimestampsCacheFactory factory)
Specifies a QueryCacheFactory to use for building query cache handlers.
|
T |
applyValidatorFactory(Object validatorFactory)
Apply a Bean Validation ValidatorFactory to the SessionFactory being built.
|
SessionFactory |
build()
After all options have been set, build the SessionFactory.
|
protected SessionFactoryBuilder |
delegate() |
SessionFactoryBuilder |
enableJpaClosedCompliance(boolean enabled) |
SessionFactoryBuilder |
enableJpaListCompliance(boolean enabled) |
SessionFactoryBuilder |
enableJpaQueryCompliance(boolean enabled) |
SessionFactoryBuilder |
enableJpaTransactionCompliance(boolean enabled) |
T |
enableReleaseResourcesOnCloseEnabled(boolean enable)
Should resources held by
EntityManager instance be released immediately on close?
<p/>
The other option is to release them as part of an after-transaction callback. |
protected abstract T |
getThis()
Returns a specific implementation.
|
<S extends SessionFactoryBuilder> |
unwrap(Class<S> type)
Allows unwrapping this builder as another, more specific type.
|
public AbstractDelegatingSessionFactoryBuilder(SessionFactoryBuilder delegate)
protected abstract T getThis()
Returns a specific implementation. See the <a href="http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ206">What is the "getThis trick?"</a>.
protected SessionFactoryBuilder delegate()
public T applyValidatorFactory(Object validatorFactory)
SessionFactoryBuilderApply a Bean Validation ValidatorFactory to the SessionFactory being built.
NOTE : De-typed to avoid hard dependency on Bean Validation jar at runtime.
applyValidatorFactory in interface SessionFactoryBuildervalidatorFactory - The Bean Validation ValidatorFactory to usethis, for method chainingpublic T applyBeanManager(Object beanManager)
SessionFactoryBuilderApply a CDI BeanManager to the SessionFactory being built.
NOTE : De-typed to avoid hard dependency on CDI jar at runtime.
applyBeanManager in interface SessionFactoryBuilderbeanManager - The CDI BeanManager to usethis, for method chainingpublic T applyName(String sessionFactoryName)
SessionFactoryBuilderApplies a SessionFactory name.
applyName in interface SessionFactoryBuildersessionFactoryName - The name to use for the SessionFactory being builtthis, for method chainingAvailableSettings.SESSION_FACTORY_NAMEpublic T applyNameAsJndiName(boolean isJndiName)
SessionFactoryBuilderApplies a SessionFactory name.
applyNameAsJndiName in interface SessionFactoryBuilderisJndiName - true indicates that the name specified in
SessionFactoryBuilder.applyName(java.lang.String) will be used for binding the SessionFactory into JNDI.this, for method chainingAvailableSettings.SESSION_FACTORY_NAME_IS_JNDIpublic T applyAutoClosing(boolean enabled)
SessionFactoryBuilderApplies whether Sessions should be automatically closed at the end of the transaction.
applyAutoClosing in interface SessionFactoryBuilderenabled - true indicates they should be auto-closed; false indicates not.this, for method chainingAvailableSettings.AUTO_CLOSE_SESSIONpublic T applyAutoFlushing(boolean enabled)
SessionFactoryBuilderApplies whether Sessions should be automatically flushed at the end of the transaction.
applyAutoFlushing in interface SessionFactoryBuilderenabled - true indicates they should be auto-flushed; false indicates not.this, for method chainingAvailableSettings.FLUSH_BEFORE_COMPLETIONpublic T applyStatisticsSupport(boolean enabled)
SessionFactoryBuilderApplies whether statistics gathering is enabled.
applyStatisticsSupport in interface SessionFactoryBuilderenabled - true indicates that statistics gathering should be enabled; false indicates not.this, for method chainingAvailableSettings.GENERATE_STATISTICSpublic T applyInterceptor(Interceptor interceptor)
SessionFactoryBuilderNames an interceptor to be applied to the SessionFactory, which in turn means it will be used by all
Sessions unless one is explicitly specified in SessionBuilder.interceptor(org.hibernate.Interceptor)
applyInterceptor in interface SessionFactoryBuilderinterceptor - The interceptorthis, for method chainingAvailableSettings.INTERCEPTORpublic T applyStatementInspector(StatementInspector statementInspector)
SessionFactoryBuilderNames a StatementInspector to be applied to the SessionFactory, which in turn means it will be used by all
Sessions unless one is explicitly specified in SessionBuilder.statementInspector(org.hibernate.resource.jdbc.spi.StatementInspector)
applyStatementInspector in interface SessionFactoryBuilderstatementInspector - The StatementInspectorthis, for method chainingAvailableSettings.STATEMENT_INSPECTORpublic T addSessionFactoryObservers(SessionFactoryObserver... observers)
SessionFactoryBuilderSpecifies one or more observers to be applied to the SessionFactory. Can be called multiple times to add additional observers.
addSessionFactoryObservers in interface SessionFactoryBuilderobservers - The observers to addthis, for method chainingpublic T applyCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy strategy)
SessionFactoryBuilderSpecifies a custom entity dirtiness strategy to be applied to the SessionFactory. See the contract
of CustomEntityDirtinessStrategy for details.
applyCustomEntityDirtinessStrategy in interface SessionFactoryBuilderstrategy - The custom strategy to be used.this, for method chainingAvailableSettings.CUSTOM_ENTITY_DIRTINESS_STRATEGYpublic T addEntityNameResolver(EntityNameResolver... entityNameResolvers)
SessionFactoryBuilderSpecifies one or more entity name resolvers to be applied to the SessionFactory (see the EntityNameResolver
contract for more information.. Can be called multiple times to add additional resolvers..
addEntityNameResolver in interface SessionFactoryBuilderentityNameResolvers - The entityNameResolvers to addthis, for method chainingpublic T applyEntityNotFoundDelegate(EntityNotFoundDelegate entityNotFoundDelegate)
SessionFactoryBuilderNames the EntityNotFoundDelegate to be applied to the SessionFactory. EntityNotFoundDelegate is a
strategy that accounts for different exceptions thrown between Hibernate and JPA when an entity cannot be found.
applyEntityNotFoundDelegate in interface SessionFactoryBuilderentityNotFoundDelegate - The delegate/strategy to use.this, for method chainingpublic T applyIdentifierRollbackSupport(boolean enabled)
SessionFactoryBuilderShould generated identifiers be "unset" on entities during a rollback?
applyIdentifierRollbackSupport in interface SessionFactoryBuilderenabled - true indicates identifiers should be unset; false indicates not.this, for method chainingAvailableSettings.USE_IDENTIFIER_ROLLBACKpublic T applyDefaultEntityMode(EntityMode entityMode)
SessionFactoryBuilderApplies the given entity mode as the default for the SessionFactory.
applyDefaultEntityMode in interface SessionFactoryBuilderentityMode - The default entity mode to use.this, for method chainingAvailableSettings.DEFAULT_ENTITY_MODEpublic T applyNullabilityChecking(boolean enabled)
SessionFactoryBuilderShould attributes using columns marked as not-null be checked (by Hibernate) for nullness?
applyNullabilityChecking in interface SessionFactoryBuilderenabled - true indicates that Hibernate should perform nullness checking; false indicates
it should not.this, for method chainingAvailableSettings.CHECK_NULLABILITYpublic T applyLazyInitializationOutsideTransaction(boolean enabled)
SessionFactoryBuilderShould the application be allowed to initialize uninitialized lazy state outside the bounds of a transaction?
applyLazyInitializationOutsideTransaction in interface SessionFactoryBuilderenabled - true indicates initialization outside the transaction should be allowed; false
indicates it should not.this, for method chainingAvailableSettings.ENABLE_LAZY_LOAD_NO_TRANSpublic T applyEntityTuplizerFactory(EntityTuplizerFactory entityTuplizerFactory)
SessionFactoryBuilderSpecify the EntityTuplizerFactory to use.
applyEntityTuplizerFactory in interface SessionFactoryBuilderentityTuplizerFactory - The EntityTuplizerFactory to use.this, for method chainingpublic T applyEntityTuplizer(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass)
SessionFactoryBuilderRegister the default EntityTuplizer to be applied to the SessionFactory.
applyEntityTuplizer in interface SessionFactoryBuilderentityMode - The entity mode that which this tuplizer will be applied.tuplizerClass - The custom tuplizer class.this, for method chainingpublic T applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy)
SessionFactoryBuilderHow should updates and deletes that span multiple tables be handled?
applyMultiTableBulkIdStrategy in interface SessionFactoryBuilderstrategy - The strategy for handling multi-table updates and deletes.this, for method chainingAvailableSettings.HQL_BULK_ID_STRATEGYpublic T applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling)
applyTempTableDdlTransactionHandling in interface SessionFactoryBuilderpublic T applyBatchFetchStyle(BatchFetchStyle style)
SessionFactoryBuilderWhat style of batching should be used?
applyBatchFetchStyle in interface SessionFactoryBuilderstyle - The style to usethis, for method chainingAvailableSettings.BATCH_FETCH_STYLEpublic SessionFactoryBuilder applyDelayedEntityLoaderCreations(boolean delay)
SessionFactoryBuilderShould entity Loaders be generated immediately? Or should the creation be delayed until first need?
applyDelayedEntityLoaderCreations in interface SessionFactoryBuilderAvailableSettings.DELAY_ENTITY_LOADER_CREATIONSpublic T applyDefaultBatchFetchSize(int size)
SessionFactoryBuilderAllows specifying a default batch-fetch size for all entities and collections which do not otherwise specify a batch-fetch size.
applyDefaultBatchFetchSize in interface SessionFactoryBuildersize - The size to use for batch fetching for entities/collections which
do not specify an explicit batch fetch size.this, for method chainingAvailableSettings.DEFAULT_BATCH_FETCH_SIZEpublic T applyMaximumFetchDepth(int depth)
SessionFactoryBuilderApply a limit to the depth Hibernate will use for outer joins. Note that this is different than an overall limit on the number of joins…
applyMaximumFetchDepth in interface SessionFactoryBuilderdepth - The depth for limiting joins.this, for method chainingAvailableSettings.MAX_FETCH_DEPTHpublic T applyDefaultNullPrecedence(NullPrecedence nullPrecedence)
SessionFactoryBuilderApply a null precedence (NULLS FIRST, NULLS LAST) to be applied order-by clauses rendered into SQL queries.
applyDefaultNullPrecedence in interface SessionFactoryBuildernullPrecedence - The default null precedence to use.this, for method chainingAvailableSettings.DEFAULT_NULL_ORDERINGpublic T applyOrderingOfInserts(boolean enabled)
SessionFactoryBuilderApply whether ordering of inserts should be enabled. This allows more efficient SQL generation via the use of batching for the inserts; the cost is that the determination of the ordering is far more inefficient than not ordering.
applyOrderingOfInserts in interface SessionFactoryBuilderenabled - true indicates that ordering should be enabled; false indicates notthis, for method chainingAvailableSettings.ORDER_INSERTSpublic T applyOrderingOfUpdates(boolean enabled)
SessionFactoryBuilderApply whether ordering of updates should be enabled. This allows more efficient SQL generation via the use of batching for the updates; the cost is that the determination of the ordering is far more inefficient than not ordering.
applyOrderingOfUpdates in interface SessionFactoryBuilderenabled - true indicates that ordering should be enabled; false indicates notthis, for method chainingAvailableSettings.ORDER_UPDATESpublic T applyMultiTenancyStrategy(MultiTenancyStrategy strategy)
SessionFactoryBuilderApply the form of multi-tenancy used by the application
applyMultiTenancyStrategy in interface SessionFactoryBuilderstrategy - The form of multi-tenancy in use.this, for method chainingAvailableSettings.MULTI_TENANTpublic T applyCurrentTenantIdentifierResolver(CurrentTenantIdentifierResolver resolver)
SessionFactoryBuilderSpecifies a strategy for resolving the notion of a "current" tenant-identifier when using multi-tenancy together with current sessions
applyCurrentTenantIdentifierResolver in interface SessionFactoryBuilderresolver - The resolution strategy to use.this, for method chainingAvailableSettings.MULTI_TENANT_IDENTIFIER_RESOLVERpublic T applyJtaTrackingByThread(boolean enabled)
SessionFactoryBuilderIf using the built-in Hibernate JTA-based TransactionCoordinator/Builder, should it track JTA transactions by thread in an attempt to detect timeouts?
applyJtaTrackingByThread in interface SessionFactoryBuilderenabled - true indicates we should track by thread; false indicates notthis, for method chainingAvailableSettings.JTA_TRACK_BY_THREADpublic T applyPreferUserTransactions(boolean preferUserTransactions)
SessionFactoryBuilderIf using the built-in Hibernate JTA-based TransactionCoordinator/Builder, should it prefer to use
UserTransaction over Transaction?
applyPreferUserTransactions in interface SessionFactoryBuilderpreferUserTransactions - true indicates we should prefer UserTransaction;
false indicates we should prefer Transactionthis, for method chainingAvailableSettings.PREFER_USER_TRANSACTIONpublic T applyQuerySubstitutions(Map substitutions)
SessionFactoryBuilderApply query substitutions to use in HQL queries. Note, this is a legacy feature and almost always never needed anymore…
applyQuerySubstitutions in interface SessionFactoryBuildersubstitutions - The substitution mapthis, for method chainingAvailableSettings.QUERY_SUBSTITUTIONSpublic T applyStrictJpaQueryLanguageCompliance(boolean enabled)
SessionFactoryBuilderShould we strictly adhere to JPA Query Language (JPQL) syntax, or more broadly support
all of Hibernate’s superset (HQL)?
<p/>
Setting this to true may cause valid HQL to throw an exception because it violates
the JPQL subset.
applyStrictJpaQueryLanguageCompliance in interface SessionFactoryBuilderenabled - true indicates that we should strictly adhere to the JPQL subset; false
indicates we should accept the broader HQL syntax.this, for method chainingAvailableSettings.JPAQL_STRICT_COMPLIANCEpublic T applyNamedQueryCheckingOnStartup(boolean enabled)
SessionFactoryBuilderShould named queries be checked on startup?
applyNamedQueryCheckingOnStartup in interface SessionFactoryBuilderenabled - true indicates that they should; false indicates they should not.this, for method chainingAvailableSettings.QUERY_STARTUP_CHECKINGpublic T applySecondLevelCacheSupport(boolean enabled)
SessionFactoryBuilderShould second level caching support be enabled?
applySecondLevelCacheSupport in interface SessionFactoryBuilderenabled - true indicates we should enable the use of second level caching; false
indicates we should disable the use of second level caching.this, for method chainingAvailableSettings.USE_SECOND_LEVEL_CACHEpublic T applyQueryCacheSupport(boolean enabled)
SessionFactoryBuilderShould second level query caching support be enabled?
applyQueryCacheSupport in interface SessionFactoryBuilderenabled - true indicates we should enable the use of second level query
caching; false indicates we should disable the use of second level query caching.this, for method chainingAvailableSettings.USE_QUERY_CACHEpublic SessionFactoryBuilder applyTimestampsCacheFactory(TimestampsCacheFactory factory)
SessionFactoryBuilderSpecifies a QueryCacheFactory to use for building query cache handlers.
applyTimestampsCacheFactory in interface SessionFactoryBuilderfactory - The QueryCacheFactory to usethis, for method chainingAvailableSettings.QUERY_CACHE_FACTORYpublic T applyCacheRegionPrefix(String prefix)
SessionFactoryBuilderApply a prefix to prepended to all cache region names for this SessionFactory.
applyCacheRegionPrefix in interface SessionFactoryBuilderprefix - The prefix.this, for method chainingAvailableSettings.CACHE_REGION_PREFIXpublic T applyMinimalPutsForCaching(boolean enabled)
SessionFactoryBuilderBy default, Hibernate will always just push data into the cache without first checking if that data already exists. For some caches (mainly distributed caches) this can have a major adverse performance impact. For these caches, it is best to enable this "minimal puts" feature. <p/> Cache integrations also report whether "minimal puts" should be enabled by default. So its is very rare that users need to set this, generally speaking.
applyMinimalPutsForCaching in interface SessionFactoryBuilderenabled - true indicates Hibernate should first check whether data exists and only
push to the cache if it does not already exist. false indicates to perform the default
behavior.this, for method chainingAvailableSettings.USE_MINIMAL_PUTS,
RegionFactory.isMinimalPutsEnabledByDefault()public T applyStructuredCacheEntries(boolean enabled)
SessionFactoryBuilderBy default, Hibernate stores data in the cache in its own optimized format. However, that format is impossible to "read" if browsing the cache. The use of "structured" cache entries allows the cached data to be read.
applyStructuredCacheEntries in interface SessionFactoryBuilderenabled - true indicates that structured cache entries (human readable) should be used;
false indicates that the native entry structure should be used.this, for method chainingAvailableSettings.USE_STRUCTURED_CACHEpublic T applyDirectReferenceCaching(boolean enabled)
SessionFactoryBuilderGenerally, Hibernate will extract the information from an entity and put that extracted information into the second-level cache. This is by far the safest way to second-level cache persistent data. However, there are some cases where it is safe to cache the entity instance directly. This setting controls whether that is used in those cases.
applyDirectReferenceCaching in interface SessionFactoryBuilderenabled - true indicates that applicable entities will be stored into the
second-level cache directly by reference; false indicates that all entities will be stored
via the extraction approach.this, for method chainingAvailableSettings.USE_DIRECT_REFERENCE_CACHE_ENTRIESpublic T applyAutomaticEvictionOfCollectionCaches(boolean enabled)
SessionFactoryBuilderWhen using bi-directional many-to-one associations and caching the one-to-many side it is expected that both sides of the association are managed (actually that is true of all bi-directional associations). However, in this case, if the user forgets to manage the one-to-many side stale data can be left in the second-level cache. <p/> Warning: enabling this will have a performance impact. Hence why it is disabled by default (for good citizens) and is an opt-in setting.
applyAutomaticEvictionOfCollectionCaches in interface SessionFactoryBuilderenabled - true indicates that these collection caches should be evicted automatically.this, for method chainingAvailableSettings.AUTO_EVICT_COLLECTION_CACHEpublic T applyJdbcBatchSize(int size)
SessionFactoryBuilderSpecifies the maximum number of statements to batch together in a JDBC batch for insert, update and delete operations. A non-zero number enables batching, but really only a number greater than zero will have any effect. If used, a number great than 5 is suggested.
applyJdbcBatchSize in interface SessionFactoryBuildersize - The batch size to use.this, for method chainingAvailableSettings.STATEMENT_BATCH_SIZEpublic T applyJdbcBatchingForVersionedEntities(boolean enabled)
SessionFactoryBuilderThis setting controls whether versioned entities will be included in JDBC batching. The reason
being that some JDBC drivers have a problems returning "accurate" update counts from batch statements.
This is setting is false by default.
applyJdbcBatchingForVersionedEntities in interface SessionFactoryBuilderenabled - The batch size to use.this, for method chainingAvailableSettings.BATCH_VERSIONED_DATApublic T applyScrollableResultsSupport(boolean enabled)
SessionFactoryBuilderShould scrollable results be supported in queries? We ask the JDBC driver whether it supports scrollable result sets as the default for this setting, but some drivers do not accurately report this via DatabaseMetaData. Also, needed if user is supplying connections (and so no Connection is available when we bootstrap).
applyScrollableResultsSupport in interface SessionFactoryBuilderenabled - true to enable this support, false to disable itthis, for method chainingAvailableSettings.USE_SCROLLABLE_RESULTSETpublic T applyResultSetsWrapping(boolean enabled)
SessionFactoryBuilderHibernate currently accesses results from the JDBC ResultSet by name. This is known to be VERY slow on some drivers, especially older Oracle drivers. This setting allows Hibernate to wrap the ResultSet of the JDBC driver to manage the name→position resolution itself.
applyResultSetsWrapping in interface SessionFactoryBuilderenabled - true indicates Hibernate should wrap result sets; false indicates
it should not.this, for method chainingAvailableSettings.WRAP_RESULT_SETSpublic T applyGetGeneratedKeysSupport(boolean enabled)
SessionFactoryBuilderShould JDBC Statement.getGeneratedKeys() feature be used for
retrieval of insert-generated ids?
applyGetGeneratedKeysSupport in interface SessionFactoryBuilderenabled - true indicates we should use JDBC getGeneratedKeys support; false
indicates we should not.this, for method chainingAvailableSettings.USE_GET_GENERATED_KEYSpublic T applyJdbcFetchSize(int size)
SessionFactoryBuilderApply a fetch size to the JDBC driver for fetching results.
applyJdbcFetchSize in interface SessionFactoryBuildersize - The fetch saize to be passed to the driver.this, for method chainingAvailableSettings.USE_GET_GENERATED_KEYS,
Statement.setFetchSize(int)public T applyConnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
SessionFactoryBuilderApply a ConnectionReleaseMode.
applyConnectionReleaseMode in interface SessionFactoryBuilderconnectionReleaseMode - The ConnectionReleaseMode to use.this, for method chainingAvailableSettings.RELEASE_CONNECTIONSpublic SessionFactoryBuilder applyConnectionProviderDisablesAutoCommit(boolean providerDisablesAutoCommit)
applyConnectionProviderDisablesAutoCommit in interface SessionFactoryBuilderAvailableSettings.CONNECTION_PROVIDER_DISABLES_AUTOCOMMITpublic T applySqlComments(boolean enabled)
SessionFactoryBuilderShould Hibernate apply comments to SQL it generates?
applySqlComments in interface SessionFactoryBuilderenabled - true indicates comments should be applied; false indicates not.this, for method chainingAvailableSettings.USE_SQL_COMMENTSpublic T applySqlFunction(String registrationName, SQLFunction sqlFunction)
SessionFactoryBuilderApply a SQLFunction to the underlying SQLFunctionRegistry.
<p/>
TODO : Ultimately I would like this to move to MetadataBuilder in conjunction with allowing mappings to reference SQLFunctions.
today mappings can only name SQL functions directly, not through the SQLFunctionRegistry indirection
applySqlFunction in interface SessionFactoryBuilderregistrationName - The name to register it under.sqlFunction - The SQLFunction implthis, for method chainingpublic T allowOutOfTransactionUpdateOperations(boolean allow)
allowOutOfTransactionUpdateOperations in interface SessionFactoryBuilderpublic T enableReleaseResourcesOnCloseEnabled(boolean enable)
SessionFactoryBuilderShould resources held by EntityManager instance be released immediately on close?
<p/>
The other option is to release them as part of an after-transaction callback.
enableReleaseResourcesOnCloseEnabled in interface SessionFactoryBuilderpublic SessionFactoryBuilder enableJpaQueryCompliance(boolean enabled)
enableJpaQueryCompliance in interface SessionFactoryBuilderJpaCompliance.isJpaQueryComplianceEnabled()public SessionFactoryBuilder enableJpaTransactionCompliance(boolean enabled)
enableJpaTransactionCompliance in interface SessionFactoryBuilderJpaCompliance.isJpaTransactionComplianceEnabled()public SessionFactoryBuilder enableJpaListCompliance(boolean enabled)
enableJpaListCompliance in interface SessionFactoryBuilderJpaCompliance.isJpaListComplianceEnabled()public SessionFactoryBuilder enableJpaClosedCompliance(boolean enabled)
enableJpaClosedCompliance in interface SessionFactoryBuilderJpaCompliance.isJpaClosedComplianceEnabled()public <S extends SessionFactoryBuilder> S unwrap(Class<S> type)
SessionFactoryBuilderAllows unwrapping this builder as another, more specific type.
unwrap in interface SessionFactoryBuilderpublic T applyStatelessInterceptor(Supplier<? extends Interceptor> statelessInterceptorSupplier)
SessionFactoryBuilderNames a Supplier instance which is used to retrieve the interceptor to be applied to the SessionFactory,
which in turn means it will be used by all Sessions unless one is explicitly specified in
SessionBuilder.interceptor(org.hibernate.Interceptor)
applyStatelessInterceptor in interface SessionFactoryBuilderstatelessInterceptorSupplier - Supplier instance which is used to retrieve the interceptorthis, for method chainingAvailableSettings.SESSION_SCOPED_INTERCEPTORpublic T applyStatelessInterceptor(Class<? extends Interceptor> statelessInterceptorClass)
SessionFactoryBuilderNames an interceptor Class to be applied to the SessionFactory, which in turn means it will be used by all
Sessions unless one is explicitly specified in SessionBuilder.interceptor(org.hibernate.Interceptor)
applyStatelessInterceptor in interface SessionFactoryBuilderstatelessInterceptorClass - The interceptor classthis, for method chainingAvailableSettings.SESSION_SCOPED_INTERCEPTORpublic T applyConnectionHandlingMode(PhysicalConnectionHandlingMode connectionHandlingMode)
SessionFactoryBuilderApply the specified handling mode for JDBC connections
applyConnectionHandlingMode in interface SessionFactoryBuilderconnectionHandlingMode - The handling mode to applythis, for method chainingAvailableSettings.ACQUIRE_CONNECTIONS,
AvailableSettings.RELEASE_CONNECTIONS,
ConnectionAcquisitionMode,
ConnectionReleaseModepublic SessionFactory build()
SessionFactoryBuilderAfter all options have been set, build the SessionFactory.
build in interface SessionFactoryBuilderCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.