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 SessionFactoryBuilder
public abstract class AbstractDelegatingSessionFactoryBuilder<T extends AbstractDelegatingSessionFactoryBuilder<T>> extends Object implements SessionFactoryBuilder
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 |
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 |
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.
|
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 |
applyQueryCacheFactory(QueryCacheFactory factory)
Specifies a QueryCacheFactory to use for building query cache handlers.
|
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 |
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)?
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) |
T |
applyValidatorFactory(Object validatorFactory)
Apply a Bean Validation ValidatorFactory to the SessionFactory being built.
|
protected abstract T |
getThis()
Returns a specific implementation.
|
<S extends SessionFactoryBuilder> |
unwrap(Class<S> type)
Allows unwrapping this builder as another, more specific type.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
build
public AbstractDelegatingSessionFactoryBuilder(SessionFactoryBuilder delegate)
protected abstract T getThis()
public T applyValidatorFactory(Object validatorFactory)
SessionFactoryBuilder
applyValidatorFactory
in interface SessionFactoryBuilder
validatorFactory
- The Bean Validation ValidatorFactory to usethis
, for method chainingpublic T applyBeanManager(Object beanManager)
SessionFactoryBuilder
applyBeanManager
in interface SessionFactoryBuilder
beanManager
- The CDI BeanManager to usethis
, for method chainingpublic T applyName(String sessionFactoryName)
SessionFactoryBuilder
applyName
in interface SessionFactoryBuilder
sessionFactoryName
- The name to use for the SessionFactory being builtthis
, for method chainingAvailableSettings.SESSION_FACTORY_NAME
public T applyNameAsJndiName(boolean isJndiName)
SessionFactoryBuilder
applyNameAsJndiName
in interface SessionFactoryBuilder
isJndiName
- 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_JNDI
public T applyAutoClosing(boolean enabled)
SessionFactoryBuilder
applyAutoClosing
in interface SessionFactoryBuilder
enabled
- true
indicates they should be auto-closed; false
indicates not.this
, for method chainingAvailableSettings.AUTO_CLOSE_SESSION
public T applyAutoFlushing(boolean enabled)
SessionFactoryBuilder
applyAutoFlushing
in interface SessionFactoryBuilder
enabled
- true
indicates they should be auto-flushed; false
indicates not.this
, for method chainingAvailableSettings.FLUSH_BEFORE_COMPLETION
public T applyStatisticsSupport(boolean enabled)
SessionFactoryBuilder
applyStatisticsSupport
in interface SessionFactoryBuilder
enabled
- true
indicates that statistics gathering should be enabled; false
indicates not.this
, for method chainingAvailableSettings.GENERATE_STATISTICS
public T applyInterceptor(Interceptor interceptor)
SessionFactoryBuilder
SessionBuilder.interceptor(org.hibernate.Interceptor)
applyInterceptor
in interface SessionFactoryBuilder
interceptor
- The interceptorthis
, for method chainingAvailableSettings.INTERCEPTOR
public T applyStatementInspector(StatementInspector statementInspector)
SessionFactoryBuilder
SessionBuilder.statementInspector(org.hibernate.resource.jdbc.spi.StatementInspector)
applyStatementInspector
in interface SessionFactoryBuilder
statementInspector
- The StatementInspectorthis
, for method chainingAvailableSettings.STATEMENT_INSPECTOR
public T addSessionFactoryObservers(SessionFactoryObserver... observers)
SessionFactoryBuilder
addSessionFactoryObservers
in interface SessionFactoryBuilder
observers
- The observers to addthis
, for method chainingpublic T applyCustomEntityDirtinessStrategy(CustomEntityDirtinessStrategy strategy)
SessionFactoryBuilder
CustomEntityDirtinessStrategy
for details.applyCustomEntityDirtinessStrategy
in interface SessionFactoryBuilder
strategy
- The custom strategy to be used.this
, for method chainingAvailableSettings.CUSTOM_ENTITY_DIRTINESS_STRATEGY
public T addEntityNameResolver(EntityNameResolver... entityNameResolvers)
SessionFactoryBuilder
EntityNameResolver
contract for more information.. Can be called multiple times to add additional resolvers..addEntityNameResolver
in interface SessionFactoryBuilder
entityNameResolvers
- The entityNameResolvers to addthis
, for method chainingpublic T applyEntityNotFoundDelegate(EntityNotFoundDelegate entityNotFoundDelegate)
SessionFactoryBuilder
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 SessionFactoryBuilder
entityNotFoundDelegate
- The delegate/strategy to use.this
, for method chainingpublic T applyIdentifierRollbackSupport(boolean enabled)
SessionFactoryBuilder
applyIdentifierRollbackSupport
in interface SessionFactoryBuilder
enabled
- true
indicates identifiers should be unset; false
indicates not.this
, for method chainingAvailableSettings.USE_IDENTIFIER_ROLLBACK
public T applyDefaultEntityMode(EntityMode entityMode)
SessionFactoryBuilder
applyDefaultEntityMode
in interface SessionFactoryBuilder
entityMode
- The default entity mode to use.this
, for method chainingAvailableSettings.DEFAULT_ENTITY_MODE
public T applyNullabilityChecking(boolean enabled)
SessionFactoryBuilder
applyNullabilityChecking
in interface SessionFactoryBuilder
enabled
- true
indicates that Hibernate should perform nullness checking; false
indicates
it should not.this
, for method chainingAvailableSettings.CHECK_NULLABILITY
public T applyLazyInitializationOutsideTransaction(boolean enabled)
SessionFactoryBuilder
applyLazyInitializationOutsideTransaction
in interface SessionFactoryBuilder
enabled
- true
indicates initialization outside the transaction should be allowed; false
indicates it should not.this
, for method chainingAvailableSettings.ENABLE_LAZY_LOAD_NO_TRANS
public T applyEntityTuplizerFactory(EntityTuplizerFactory entityTuplizerFactory)
SessionFactoryBuilder
applyEntityTuplizerFactory
in interface SessionFactoryBuilder
entityTuplizerFactory
- The EntityTuplizerFactory to use.this
, for method chainingpublic T applyEntityTuplizer(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass)
SessionFactoryBuilder
EntityTuplizer
to be applied to the SessionFactory.applyEntityTuplizer
in interface SessionFactoryBuilder
entityMode
- The entity mode that which this tuplizer will be applied.tuplizerClass
- The custom tuplizer class.this
, for method chainingpublic T applyMultiTableBulkIdStrategy(MultiTableBulkIdStrategy strategy)
SessionFactoryBuilder
applyMultiTableBulkIdStrategy
in interface SessionFactoryBuilder
strategy
- The strategy for handling multi-table updates and deletes.this
, for method chainingAvailableSettings.HQL_BULK_ID_STRATEGY
public T applyTempTableDdlTransactionHandling(TempTableDdlTransactionHandling handling)
applyTempTableDdlTransactionHandling
in interface SessionFactoryBuilder
public T applyBatchFetchStyle(BatchFetchStyle style)
SessionFactoryBuilder
applyBatchFetchStyle
in interface SessionFactoryBuilder
style
- The style to usethis
, for method chainingAvailableSettings.BATCH_FETCH_STYLE
public T applyDefaultBatchFetchSize(int size)
SessionFactoryBuilder
applyDefaultBatchFetchSize
in interface SessionFactoryBuilder
size
- 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_SIZE
public T applyMaximumFetchDepth(int depth)
SessionFactoryBuilder
applyMaximumFetchDepth
in interface SessionFactoryBuilder
depth
- The depth for limiting joins.this
, for method chainingAvailableSettings.MAX_FETCH_DEPTH
public T applyDefaultNullPrecedence(NullPrecedence nullPrecedence)
SessionFactoryBuilder
applyDefaultNullPrecedence
in interface SessionFactoryBuilder
nullPrecedence
- The default null precedence to use.this
, for method chainingAvailableSettings.DEFAULT_NULL_ORDERING
public T applyOrderingOfInserts(boolean enabled)
SessionFactoryBuilder
applyOrderingOfInserts
in interface SessionFactoryBuilder
enabled
- true
indicates that ordering should be enabled; false
indicates notthis
, for method chainingAvailableSettings.ORDER_INSERTS
public T applyOrderingOfUpdates(boolean enabled)
SessionFactoryBuilder
applyOrderingOfUpdates
in interface SessionFactoryBuilder
enabled
- true
indicates that ordering should be enabled; false
indicates notthis
, for method chainingAvailableSettings.ORDER_UPDATES
public T applyMultiTenancyStrategy(MultiTenancyStrategy strategy)
SessionFactoryBuilder
applyMultiTenancyStrategy
in interface SessionFactoryBuilder
strategy
- The form of multi-tenancy in use.this
, for method chainingAvailableSettings.MULTI_TENANT
public T applyCurrentTenantIdentifierResolver(CurrentTenantIdentifierResolver resolver)
SessionFactoryBuilder
applyCurrentTenantIdentifierResolver
in interface SessionFactoryBuilder
resolver
- The resolution strategy to use.this
, for method chainingAvailableSettings.MULTI_TENANT_IDENTIFIER_RESOLVER
public T applyJtaTrackingByThread(boolean enabled)
SessionFactoryBuilder
applyJtaTrackingByThread
in interface SessionFactoryBuilder
enabled
- true
indicates we should track by thread; false
indicates notthis
, for method chainingAvailableSettings.JTA_TRACK_BY_THREAD
public T applyPreferUserTransactions(boolean preferUserTransactions)
SessionFactoryBuilder
UserTransaction
over Transaction
?applyPreferUserTransactions
in interface SessionFactoryBuilder
preferUserTransactions
- true
indicates we should prefer UserTransaction
;
false
indicates we should prefer Transaction
this
, for method chainingAvailableSettings.PREFER_USER_TRANSACTION
public T applyQuerySubstitutions(Map substitutions)
SessionFactoryBuilder
applyQuerySubstitutions
in interface SessionFactoryBuilder
substitutions
- The substitution mapthis
, for method chainingAvailableSettings.QUERY_SUBSTITUTIONS
public T applyStrictJpaQueryLanguageCompliance(boolean enabled)
SessionFactoryBuilder
true
may cause valid HQL to throw an exception because it violates
the JPQL subset.applyStrictJpaQueryLanguageCompliance
in interface SessionFactoryBuilder
enabled
- 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_COMPLIANCE
public T applyNamedQueryCheckingOnStartup(boolean enabled)
SessionFactoryBuilder
applyNamedQueryCheckingOnStartup
in interface SessionFactoryBuilder
enabled
- true
indicates that they should; false
indicates they should not.this
, for method chainingAvailableSettings.QUERY_STARTUP_CHECKING
public T applySecondLevelCacheSupport(boolean enabled)
SessionFactoryBuilder
applySecondLevelCacheSupport
in interface SessionFactoryBuilder
enabled
- 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_CACHE
public T applyQueryCacheSupport(boolean enabled)
SessionFactoryBuilder
applyQueryCacheSupport
in interface SessionFactoryBuilder
enabled
- 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_CACHE
public T applyQueryCacheFactory(QueryCacheFactory factory)
SessionFactoryBuilder
applyQueryCacheFactory
in interface SessionFactoryBuilder
factory
- The QueryCacheFactory to usethis
, for method chainingAvailableSettings.QUERY_CACHE_FACTORY
public T applyCacheRegionPrefix(String prefix)
SessionFactoryBuilder
applyCacheRegionPrefix
in interface SessionFactoryBuilder
prefix
- The prefix.this
, for method chainingAvailableSettings.CACHE_REGION_PREFIX
public T applyMinimalPutsForCaching(boolean enabled)
SessionFactoryBuilder
applyMinimalPutsForCaching
in interface SessionFactoryBuilder
enabled
- 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)
SessionFactoryBuilder
applyStructuredCacheEntries
in interface SessionFactoryBuilder
enabled
- 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_CACHE
public T applyDirectReferenceCaching(boolean enabled)
SessionFactoryBuilder
applyDirectReferenceCaching
in interface SessionFactoryBuilder
enabled
- 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_ENTRIES
public T applyAutomaticEvictionOfCollectionCaches(boolean enabled)
SessionFactoryBuilder
applyAutomaticEvictionOfCollectionCaches
in interface SessionFactoryBuilder
enabled
- true
indicates that these collection caches should be evicted automatically.this
, for method chainingAvailableSettings.AUTO_EVICT_COLLECTION_CACHE
public T applyJdbcBatchSize(int size)
SessionFactoryBuilder
applyJdbcBatchSize
in interface SessionFactoryBuilder
size
- The batch size to use.this
, for method chainingAvailableSettings.STATEMENT_BATCH_SIZE
public T applyJdbcBatchingForVersionedEntities(boolean enabled)
SessionFactoryBuilder
false
by default.applyJdbcBatchingForVersionedEntities
in interface SessionFactoryBuilder
enabled
- The batch size to use.this
, for method chainingAvailableSettings.BATCH_VERSIONED_DATA
public T applyScrollableResultsSupport(boolean enabled)
SessionFactoryBuilder
applyScrollableResultsSupport
in interface SessionFactoryBuilder
enabled
- true
to enable this support, false
to disable itthis
, for method chainingAvailableSettings.USE_SCROLLABLE_RESULTSET
public T applyResultSetsWrapping(boolean enabled)
SessionFactoryBuilder
applyResultSetsWrapping
in interface SessionFactoryBuilder
enabled
- true
indicates Hibernate should wrap result sets; false
indicates
it should not.this
, for method chainingAvailableSettings.WRAP_RESULT_SETS
public T applyGetGeneratedKeysSupport(boolean enabled)
SessionFactoryBuilder
Statement.getGeneratedKeys()
feature be used for
retrieval of *insert-generated* ids?applyGetGeneratedKeysSupport
in interface SessionFactoryBuilder
enabled
- true
indicates we should use JDBC getGeneratedKeys support; false
indicates we should not.this
, for method chainingAvailableSettings.USE_GET_GENERATED_KEYS
public T applyJdbcFetchSize(int size)
SessionFactoryBuilder
applyJdbcFetchSize
in interface SessionFactoryBuilder
size
- 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)
SessionFactoryBuilder
applyConnectionReleaseMode
in interface SessionFactoryBuilder
connectionReleaseMode
- The ConnectionReleaseMode to use.this
, for method chainingAvailableSettings.RELEASE_CONNECTIONS
public T applySqlComments(boolean enabled)
SessionFactoryBuilder
applySqlComments
in interface SessionFactoryBuilder
enabled
- true
indicates comments should be applied; false
indicates not.this
, for method chainingAvailableSettings.USE_SQL_COMMENTS
public T applySqlFunction(String registrationName, SQLFunction sqlFunction)
SessionFactoryBuilder
SQLFunctionRegistry
.
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 indirectionapplySqlFunction
in interface SessionFactoryBuilder
registrationName
- The name to register it under.sqlFunction
- The SQLFunction implthis
, for method chainingpublic <S extends SessionFactoryBuilder> S unwrap(Class<S> type)
SessionFactoryBuilder
unwrap
in interface SessionFactoryBuilder
Copyright © 2016 JBoss by Red Hat. All rights reserved.