public interface SessionBuilder<T extends SessionBuilder>
Represents a consolidation of all session creation options into a builder style delegate.
| Modifier and Type | Method and Description |
|---|---|
T |
autoClear(boolean autoClear)
Should the session be automatically cleared on a failed transaction?
|
T |
autoClose(boolean autoClose)
Deprecated.
Only integrations can specify autoClosing behavior of individual sessions. See
SessionOwner |
T |
autoJoinTransactions(boolean autoJoinTransactions)
Should the session built automatically join in any ongoing JTA transactions.
|
T |
clearEventListeners()
Remove all listeners intended for the built Session currently held here, including any auto-apply ones; in other
words, start with a clean slate.
|
T |
connection(Connection connection)
Adds a specific connection to the session options.
|
T |
connectionHandlingMode(PhysicalConnectionHandlingMode mode)
Signifies that the connection release mode from the original session should be used to create the new session.
|
T |
connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
Deprecated.
(since 5.2) use
connectionHandlingMode(org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode) instead |
T |
eventListeners(SessionEventListener... listeners)
Apply one or more SessionEventListener instances to the listeners for the Session to be built.
|
default T |
flushBeforeCompletion(boolean flushBeforeCompletion)
Deprecated.
(since 5.2) use
flushMode(FlushMode) instead. |
T |
flushMode(FlushMode flushMode)
Specify the initial FlushMode to use for the opened Session
|
T |
interceptor(Interceptor interceptor)
Adds a specific interceptor to the session options.
|
T |
jdbcTimeZone(TimeZone timeZone) |
T |
noInterceptor()
Signifies that no
Interceptor should be used. |
Session |
openSession()
Opens a session with the specified options.
|
default T |
setQueryParameterValidation(boolean enabled)
Should
Query.setParameter(javax.persistence.Parameter<java.time.Instant>, java.time.Instant, javax.persistence.TemporalType) perform parameter validation
when the Session is bootstrapped via JPA EntityManagerFactory |
T |
statementInspector(StatementInspector statementInspector)
Applies a specific StatementInspector to the session options.
|
T |
tenantIdentifier(String tenantIdentifier)
Define the tenant identifier to be associated with the opened session.
|
Session openSession()
Opens a session with the specified options.
T interceptor(Interceptor interceptor)
Adds a specific interceptor to the session options.
interceptor - The interceptor to use.this, for method chainingT noInterceptor()
Signifies that no Interceptor should be used.
<p/>
By default the Interceptor associated with the SessionFactory is passed to the
Session whenever we open one without the user having specified a specific interceptor to
use.
<p/>
Calling interceptor(Interceptor) with null has the same net effect.
this, for method chainingT statementInspector(StatementInspector statementInspector)
Applies a specific StatementInspector to the session options.
statementInspector - The StatementInspector to use.this, for method chainingT connection(Connection connection)
Adds a specific connection to the session options.
connection - The connection to use.this, for method chainingT connectionHandlingMode(PhysicalConnectionHandlingMode mode)
Signifies that the connection release mode from the original session should be used to create the new session.
mode - The connection handling mode to use.this, for method chainingT autoJoinTransactions(boolean autoJoinTransactions)
Should the session built automatically join in any ongoing JTA transactions.
autoJoinTransactions - Should JTA transactions be automatically joinedthis, for method chainingSynchronizationType.SYNCHRONIZEDT autoClear(boolean autoClear)
Should the session be automatically cleared on a failed transaction?
autoClear - Whether the Session should be automatically clearedthis, for method chainingT flushMode(FlushMode flushMode)
Specify the initial FlushMode to use for the opened Session
flushMode - The initial FlushMode to use for the opened Sessionthis, for method chainingPersistenceContextTypeT tenantIdentifier(String tenantIdentifier)
Define the tenant identifier to be associated with the opened session.
tenantIdentifier - The tenant identifier.this, for method chainingT eventListeners(SessionEventListener... listeners)
Apply one or more SessionEventListener instances to the listeners for the Session to be built.
listeners - The listeners to incorporate into the built Sessionthis, for method chainingT clearEventListeners()
Remove all listeners intended for the built Session currently held here, including any auto-apply ones; in other words, start with a clean slate.
this, for method chaining
default T setQueryParameterValidation(boolean enabled)
Should Query.setParameter(javax.persistence.Parameter<java.time.Instant>, java.time.Instant, javax.persistence.TemporalType) perform parameter validation
when the Session is bootstrapped via JPA EntityManagerFactory
enabled - true indicates the validation should be performed, false otherwise
<p>
The default value is truethis, for method chaining@Deprecated T autoClose(boolean autoClose)
SessionOwnerShould the session be automatically closed after transaction completion?
autoClose - Should the session be automatically closedthis, for method chainingPersistenceContextType@Deprecated T connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
connectionHandlingMode(org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode) insteadUse a specific connection release mode for these session options.
connectionReleaseMode - The connection release mode to use.this, for method chaining@Deprecated default T flushBeforeCompletion(boolean flushBeforeCompletion)
flushMode(FlushMode) instead.Should the session be automatically flushed during the "before completion" phase of transaction handling.
flushBeforeCompletion - Should the session be automatically flushedthis, for method chainingCopyright © 2001-2018 Red Hat, Inc. All Rights Reserved.