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()
SessionBuilderopenSession in interface SessionBuilder<T extends SessionBuilder>public T interceptor(Interceptor interceptor)
SessionBuilderinterceptor in interface SessionBuilder<T extends SessionBuilder>interceptor - The interceptor to use.this, for method chainingpublic T noInterceptor()
SessionBuilderInterceptor 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)
SessionBuilderstatementInspector in interface SessionBuilder<T extends SessionBuilder>statementInspector - The StatementInspector to use.this, for method chainingpublic T connection(Connection connection)
SessionBuilderconnection in interface SessionBuilder<T extends SessionBuilder>connection - The connection to use.this, for method chainingpublic T connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
SessionBuilderconnectionReleaseMode in interface SessionBuilder<T extends SessionBuilder>connectionReleaseMode - The connection release mode to use.this, for method chainingpublic T autoJoinTransactions(boolean autoJoinTransactions)
SessionBuilderautoJoinTransactions in interface SessionBuilder<T extends SessionBuilder>autoJoinTransactions - Should JTA transactions be automatically joinedthis, for method chainingSynchronizationType.SYNCHRONIZEDpublic T autoClose(boolean autoClose)
SessionBuilderautoClose in interface SessionBuilder<T extends SessionBuilder>autoClose - Should the session be automatically closedthis, for method chainingPersistenceContextTypepublic T flushBeforeCompletion(boolean flushBeforeCompletion)
SessionBuilderflushBeforeCompletion in interface SessionBuilder<T extends SessionBuilder>flushBeforeCompletion - Should the session be automatically flushedthis, for method chainingpublic T tenantIdentifier(String tenantIdentifier)
SessionBuildertenantIdentifier in interface SessionBuilder<T extends SessionBuilder>tenantIdentifier - The tenant identifier.this, for method chainingpublic T eventListeners(SessionEventListener... listeners)
SessionBuildereventListeners in interface SessionBuilder<T extends SessionBuilder>listeners - The listeners to incorporate into the built Sessionthis, for method chainingpublic T clearEventListeners()
SessionBuilderthis, 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)
SessionBuilderQuery.setParameter(javax.persistence.Parameter<java.time.Instant>, java.time.Instant, javax.persistence.TemporalType) perform parameter validation
when the Session is bootstrapped via JPA EntityManagerFactorysetQueryParameterValidation 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)
SessionBuilderconnectionHandlingMode in interface SessionBuilder<T extends SessionBuilder>mode - The connection handling mode to use.this, for method chainingpublic T autoClear(boolean autoClear)
SessionBuilderautoClear in interface SessionBuilder<T extends SessionBuilder>autoClear - Whether the Session should be automatically clearedthis, for method chainingpublic T flushMode(FlushMode flushMode)
SessionBuilderflushMode in interface SessionBuilder<T extends SessionBuilder>flushMode - The initial FlushMode to use for the opened Sessionthis, for method chainingPersistenceContextTypeCopyright © 2001-2022 Red Hat, Inc. All Rights Reserved.