public interface SessionBuilder<T extends SessionBuilder>
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()
T interceptor(Interceptor interceptor)
interceptor
- The interceptor to use.this
, for method chainingT noInterceptor()
Interceptor
should be used.
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.
Calling interceptor(Interceptor)
with null has the same net effect.this
, for method chainingT statementInspector(StatementInspector statementInspector)
statementInspector
- The StatementInspector to use.this
, for method chainingT connection(Connection connection)
connection
- The connection to use.this
, for method chainingT connectionHandlingMode(PhysicalConnectionHandlingMode mode)
mode
- The connection handling mode to use.this
, for method chainingT autoJoinTransactions(boolean autoJoinTransactions)
autoJoinTransactions
- Should JTA transactions be automatically joinedthis
, for method chainingSynchronizationType.SYNCHRONIZED
T autoClear(boolean autoClear)
autoClear
- Whether the Session should be automatically clearedthis
, for method chainingT flushMode(FlushMode flushMode)
flushMode
- The initial FlushMode to use for the opened Sessionthis
, for method chainingPersistenceContextType
T tenantIdentifier(String tenantIdentifier)
tenantIdentifier
- The tenant identifier.this
, for method chainingT eventListeners(SessionEventListener... listeners)
listeners
- The listeners to incorporate into the built Sessionthis
, for method chainingT clearEventListeners()
this
, for method chainingdefault T setQueryParameterValidation(boolean enabled)
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
The default value is true
this
, for method chaining@Deprecated T autoClose(boolean autoClose)
SessionOwner
autoClose
- Should the session be automatically closedthis
, for method chainingPersistenceContextType
@Deprecated T connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
connectionHandlingMode(org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode)
insteadconnectionReleaseMode
- The connection release mode to use.this
, for method chaining@Deprecated default T flushBeforeCompletion(boolean flushBeforeCompletion)
flushMode(FlushMode)
instead.flushBeforeCompletion
- Should the session be automatically flushedthis
, for method chainingCopyright © 2019 JBoss by Red Hat. All rights reserved.