程序包 org.hibernate
接口 SessionBuilder<T extends SessionBuilder>
-
- 所有已知子接口:
SessionBuilderImplementor<T>,SharedSessionBuilder<T>
- 所有已知实现类:
AbstractDelegatingSessionBuilder,AbstractDelegatingSessionBuilderImplementor,AbstractDelegatingSharedSessionBuilder,SessionFactoryImpl.SessionBuilderImpl
public interface SessionBuilder<T extends SessionBuilder>Represents a consolidation of all session creation options into a builder style delegate.- 作者:
- Steve Ebersole
-
-
方法概要
所有方法 实例方法 抽象方法 默认方法 已过时的方法 修饰符和类型 方法 说明 TautoClear(boolean autoClear)Should the session be automatically cleared on a failed transaction?TautoClose(boolean autoClose)已过时。Only integrations can specify autoClosing behavior of individual sessions.TautoJoinTransactions(boolean autoJoinTransactions)Should the session built automatically join in any ongoing JTA transactions.TclearEventListeners()Remove all listeners intended for the built Session currently held here, including any auto-apply ones; in other words, start with a clean slate.Tconnection(Connection connection)Adds a specific connection to the session options.TconnectionHandlingMode(PhysicalConnectionHandlingMode mode)Signifies that the connection release mode from the original session should be used to create the new session.TconnectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)已过时。(since 5.2) useconnectionHandlingMode(org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode)insteadTeventListeners(SessionEventListener... listeners)Apply one or more SessionEventListener instances to the listeners for the Session to be built.default TflushBeforeCompletion(boolean flushBeforeCompletion)已过时。(since 5.2) useflushMode(FlushMode)instead.TflushMode(FlushMode flushMode)Specify the initial FlushMode to use for the opened SessionTinterceptor(Interceptor interceptor)Adds a specific interceptor to the session options.TjdbcTimeZone(TimeZone timeZone)TnoInterceptor()Signifies that noInterceptorshould be used.SessionopenSession()Opens a session with the specified options.default TsetQueryParameterValidation(boolean enabled)ShouldQuery.setParameter(javax.persistence.Parameter<java.time.Instant>, java.time.Instant, javax.persistence.TemporalType)perform parameter validation when the Session is bootstrapped via JPAEntityManagerFactoryTstatementInspector(StatementInspector statementInspector)Applies a specific StatementInspector to the session options.TtenantIdentifier(String tenantIdentifier)Define the tenant identifier to be associated with the opened session.
-
-
-
方法详细资料
-
openSession
Session openSession()
Opens a session with the specified options.- 返回:
- The session
-
interceptor
T interceptor(Interceptor interceptor)
Adds a specific interceptor to the session options.- 参数:
interceptor- The interceptor to use.- 返回:
this, for method chaining
-
noInterceptor
T noInterceptor()
Signifies that noInterceptorshould be used. By default theInterceptorassociated with theSessionFactoryis passed to theSessionwhenever we open one without the user having specified a specific interceptor to use. Callinginterceptor(Interceptor)with null has the same net effect.- 返回:
this, for method chaining
-
statementInspector
T statementInspector(StatementInspector statementInspector)
Applies a specific StatementInspector to the session options.- 参数:
statementInspector- The StatementInspector to use.- 返回:
this, for method chaining
-
connection
T connection(Connection connection)
Adds a specific connection to the session options.- 参数:
connection- The connection to use.- 返回:
this, for method chaining
-
connectionHandlingMode
T 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 chaining
-
autoJoinTransactions
T autoJoinTransactions(boolean autoJoinTransactions)
Should the session built automatically join in any ongoing JTA transactions.- 参数:
autoJoinTransactions- Should JTA transactions be automatically joined- 返回:
this, for method chaining- 另请参阅:
SynchronizationType.SYNCHRONIZED
-
autoClear
T autoClear(boolean autoClear)
Should the session be automatically cleared on a failed transaction?- 参数:
autoClear- Whether the Session should be automatically cleared- 返回:
this, for method chaining
-
flushMode
T flushMode(FlushMode flushMode)
Specify the initial FlushMode to use for the opened Session- 参数:
flushMode- The initial FlushMode to use for the opened Session- 返回:
this, for method chaining- 另请参阅:
PersistenceContextType
-
tenantIdentifier
T tenantIdentifier(String tenantIdentifier)
Define the tenant identifier to be associated with the opened session.- 参数:
tenantIdentifier- The tenant identifier.- 返回:
this, for method chaining
-
eventListeners
T 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 Session- 返回:
this, for method chaining
-
clearEventListeners
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.this, for method chaining
-
setQueryParameterValidation
default T setQueryParameterValidation(boolean enabled)
ShouldQuery.setParameter(javax.persistence.Parameter<java.time.Instant>, java.time.Instant, javax.persistence.TemporalType)perform parameter validation when the Session is bootstrapped via JPAEntityManagerFactory- 参数:
enabled-trueindicates the validation should be performed,falseotherwiseThe default value is
true- 返回:
this, for method chaining
-
autoClose
@Deprecated T autoClose(boolean autoClose)
已过时。Only integrations can specify autoClosing behavior of individual sessions. SeeSessionOwnerShould the session be automatically closed after transaction completion?- 参数:
autoClose- Should the session be automatically closed- 返回:
this, for method chaining- 另请参阅:
PersistenceContextType
-
connectionReleaseMode
@Deprecated T connectionReleaseMode(ConnectionReleaseMode connectionReleaseMode)
已过时。(since 5.2) useconnectionHandlingMode(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
-
flushBeforeCompletion
@Deprecated default T flushBeforeCompletion(boolean flushBeforeCompletion)
已过时。(since 5.2) useflushMode(FlushMode)instead.Should the session be automatically flushed during the "before completion" phase of transaction handling.- 参数:
flushBeforeCompletion- Should the session be automatically flushed- 返回:
this, for method chaining
-
-