public abstract class AbstractDelegatingSessionBuilder<T extends SessionBuilder> extends Object implements SessionBuilder<T>
SessionBuilder
implementations that wish to implement only parts of that contract themselves
while forwarding other method invocations to a delegate instance.Constructor and Description |
---|
AbstractDelegatingSessionBuilder(SessionBuilder 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)
Should the session be automatically closed after transaction completion?
|
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)
Use a specific connection release mode for these session options.
|
protected SessionBuilder |
delegate() |
T |
eventListeners(SessionEventListener... listeners)
Apply one or more SessionEventListener instances to the listeners for the Session to be built.
|
T |
flushBeforeCompletion(boolean flushBeforeCompletion)
Should the session be automatically flushed during the "before completion" phase of transaction handling.
|
T |
flushMode(FlushMode flushMode)
Specify the initial FlushMode to use for the opened Session
|
protected T |
getThis() |
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.
|
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.
|
public AbstractDelegatingSessionBuilder(SessionBuilder delegate)
protected T getThis()
protected SessionBuilder delegate()
public Session openSession()
SessionBuilder
openSession
in interface SessionBuilder<T extends SessionBuilder>
public T interceptor(Interceptor interceptor)
SessionBuilder
interceptor
in interface SessionBuilder<T extends SessionBuilder>
interceptor
- The interceptor to use.this
, for method chainingpublic T noInterceptor()
SessionBuilder
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 SessionBuilder.interceptor(Interceptor)
with null has the same net effect.noInterceptor
in interface SessionBuilder<T extends SessionBuilder>
this
, for method chainingpublic T statementInspector(StatementInspector statementInspector)
SessionBuilder
statementInspector
in interface SessionBuilder<T extends SessionBuilder>
statementInspector
- The StatementInspector to use.this
, for method chainingpublic T connection(Connection connection)
SessionBuilder
connection
in interface SessionBuilder<T extends SessionBuilder>
connection
- The connection to use.this
, for method chainingpublic T connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
SessionBuilder
connectionReleaseMode
in interface SessionBuilder<T extends SessionBuilder>
connectionReleaseMode
- The connection release mode to use.this
, for method chainingpublic T autoJoinTransactions(boolean autoJoinTransactions)
SessionBuilder
autoJoinTransactions
in interface SessionBuilder<T extends SessionBuilder>
autoJoinTransactions
- Should JTA transactions be automatically joinedthis
, for method chainingSynchronizationType.SYNCHRONIZED
public T autoClose(boolean autoClose)
SessionBuilder
autoClose
in interface SessionBuilder<T extends SessionBuilder>
autoClose
- Should the session be automatically closedthis
, for method chainingPersistenceContextType
public T flushBeforeCompletion(boolean flushBeforeCompletion)
SessionBuilder
flushBeforeCompletion
in interface SessionBuilder<T extends SessionBuilder>
flushBeforeCompletion
- Should the session be automatically flushedthis
, for method chainingpublic T tenantIdentifier(String tenantIdentifier)
SessionBuilder
tenantIdentifier
in interface SessionBuilder<T extends SessionBuilder>
tenantIdentifier
- The tenant identifier.this
, for method chainingpublic T eventListeners(SessionEventListener... listeners)
SessionBuilder
eventListeners
in interface SessionBuilder<T extends SessionBuilder>
listeners
- The listeners to incorporate into the built Sessionthis
, for method chainingpublic T clearEventListeners()
SessionBuilder
this
, for method chainingclearEventListeners
in interface SessionBuilder<T extends SessionBuilder>
public T jdbcTimeZone(TimeZone timeZone)
jdbcTimeZone
in interface SessionBuilder<T extends SessionBuilder>
public T setQueryParameterValidation(boolean enabled)
SessionBuilder
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
setQueryParameterValidation
in interface SessionBuilder<T extends SessionBuilder>
enabled
- true
indicates the validation should be performed, false
otherwise
The default value is true
this
, for method chainingpublic T connectionHandlingMode(PhysicalConnectionHandlingMode mode)
SessionBuilder
connectionHandlingMode
in interface SessionBuilder<T extends SessionBuilder>
mode
- The connection handling mode to use.this
, for method chainingpublic T autoClear(boolean autoClear)
SessionBuilder
autoClear
in interface SessionBuilder<T extends SessionBuilder>
autoClear
- Whether the Session should be automatically clearedthis
, for method chainingpublic T flushMode(FlushMode flushMode)
SessionBuilder
flushMode
in interface SessionBuilder<T extends SessionBuilder>
flushMode
- The initial FlushMode to use for the opened Sessionthis
, for method chainingPersistenceContextType
Copyright © 2019 JBoss by Red Hat. All rights reserved.