Package org.hibernate.cfg
Interface TransactionSettings
-
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
public interface TransactionSettings
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALLOW_JTA_TRANSACTION_ACCESS
When enabled, allows access to theTransaction
even when using a JTA for transaction management.static String
ALLOW_UPDATE_OUTSIDE_TRANSACTION
When enabled, allows update operations outside a transaction.static String
AUTO_CLOSE_SESSION
When enabled, specifies that theSession
should be closed automatically at the end of each transaction.static String
ENABLE_LAZY_LOAD_NO_TRANS
Allows a detached proxy or lazy collection to be fetched even when not associated with an open persistence context, by creating a temporary persistence context when the proxy or collection is accessed.static String
FLUSH_BEFORE_COMPLETION
When enabled, specifies that automatic flushing should occur during the JTASynchronization.beforeCompletion()
callback.static String
JTA_CACHE_TM
When enabled, indicates that it is safe to cacheTransactionManager
references in theJtaPlatform
static String
JTA_CACHE_UT
When enabled, indicates that it is safe to cacheUserTransaction
references in theJtaPlatform
static String
JTA_PLATFORM
Specifies theJtaPlatform
implementation to use for integrating with JTA, either: an instance ofJtaPlatform
, or the name of a class that implementsJtaPlatform
.static String
JTA_PLATFORM_RESOLVER
Specifies aJtaPlatformResolver
implementation that should be used to obtain an instance ofJtaPlatform
.static String
JTA_TRACK_BY_THREAD
A transaction can be rolled back by another thread ("tracking by thread") -- not the original application.static String
PREFER_USER_TRANSACTION
When enabled, specifies that theUserTransaction
should be used in preference to theTransactionManager
for JTA transaction management.static String
TRANSACTION_COORDINATOR_STRATEGY
Specify theTransactionCoordinatorBuilder
implementation to use for creating instances ofTransactionCoordinator
which the interface Hibernate uses to manage transactions.
-
-
-
Field Detail
-
TRANSACTION_COORDINATOR_STRATEGY
static final String TRANSACTION_COORDINATOR_STRATEGY
Specify theTransactionCoordinatorBuilder
implementation to use for creating instances ofTransactionCoordinator
which the interface Hibernate uses to manage transactions. Accepts either:- an instance of
TransactionCoordinatorBuilder
, - a
Class
representing a class that implementsTransactionCoordinatorBuilder
, - the name of a class that implements
TransactionCoordinatorBuilder
, jta
orjdbc
- Since:
- 5.0
- See Also:
JTA_PLATFORM
, Constant Field Values- Implementation Specification:
- With non Jakarta Persistence bootstrapping, Hibernate will use
jdbc
as the default which will cause problems if the application actually uses JTA-based transactions. - Default Value:
- With Jakarta Persistence bootstrapping, based on the persistence unit's
PersistenceUnitInfo.getTransactionType()
; otherwisejdbc
.
- an instance of
-
JTA_PLATFORM
static final String JTA_PLATFORM
Specifies theJtaPlatform
implementation to use for integrating with JTA, either:- an instance of
JtaPlatform
, or - the name of a class that implements
JtaPlatform
. - short name of a class (sans package name) that implements
JtaPlatform
.
- Since:
- 4.0
- See Also:
JTA_PLATFORM_RESOLVER
, Constant Field Values
- an instance of
-
JTA_PLATFORM_RESOLVER
static final String JTA_PLATFORM_RESOLVER
Specifies aJtaPlatformResolver
implementation that should be used to obtain an instance ofJtaPlatform
.- Since:
- 4.3
- See Also:
- Constant Field Values
-
PREFER_USER_TRANSACTION
static final String PREFER_USER_TRANSACTION
When enabled, specifies that theUserTransaction
should be used in preference to theTransactionManager
for JTA transaction management.By default, the
TransactionManager
is preferred.- Since:
- 5.0
- See Also:
JtaPlatform.retrieveUserTransaction()
,JtaPlatform.retrieveTransactionManager()
,SessionFactoryBuilder.applyPreferUserTransactions(boolean)
, Constant Field Values- Default Value:
false
asTransactionManager
is preferred.
-
JTA_CACHE_TM
static final String JTA_CACHE_TM
When enabled, indicates that it is safe to cacheTransactionManager
references in theJtaPlatform
- Since:
- 4.0
- See Also:
- Constant Field Values
- Default Value:
- Generally
true
, thoughJtaPlatform
implementations can do their own thing.
-
JTA_CACHE_UT
static final String JTA_CACHE_UT
When enabled, indicates that it is safe to cacheUserTransaction
references in theJtaPlatform
- Since:
- 4.0
- See Also:
- Constant Field Values
- Default Value:
- Generally
true
, thoughJtaPlatform
implementations can do their own thing.
-
JTA_TRACK_BY_THREAD
static final String JTA_TRACK_BY_THREAD
A transaction can be rolled back by another thread ("tracking by thread") -- not the original application. Examples of this include a JTA transaction timeout handled by a background reaper thread. The ability to handle this situation requires checking the Thread ID every time Session is called. This can certainly have performance considerations.- See Also:
SessionFactoryBuilder.applyJtaTrackingByThread(boolean)
, Constant Field Values- Default Value:
true
(enabled).
-
ALLOW_JTA_TRANSACTION_ACCESS
static final String ALLOW_JTA_TRANSACTION_ACCESS
When enabled, allows access to theTransaction
even when using a JTA for transaction management.Values are
true
, which grants access, andfalse
, which does not.- See Also:
JpaComplianceSettings.JPA_TRANSACTION_COMPLIANCE
, Constant Field Values- Default Value:
false
when bootstrapped via JPA;true
otherwise.
-
ENABLE_LAZY_LOAD_NO_TRANS
static final String ENABLE_LAZY_LOAD_NO_TRANS
Allows a detached proxy or lazy collection to be fetched even when not associated with an open persistence context, by creating a temporary persistence context when the proxy or collection is accessed. This behavior is not recommended, since it can easily break transaction isolation or lead to data aliasing; it is therefore disabled by default.- See Also:
SessionFactoryBuilder.applyLazyInitializationOutsideTransaction(boolean)
, Constant Field Values- Default Value:
false
(disabled)
-
ALLOW_UPDATE_OUTSIDE_TRANSACTION
static final String ALLOW_UPDATE_OUTSIDE_TRANSACTION
When enabled, allows update operations outside a transaction.Since version 5.2 Hibernate conforms with the JPA specification and disallows flushing any update outside a transaction.
Values are
true
, which allows flushing outside a transaction, andfalse
, which does not.The default behavior is to disallow update operations outside a transaction.
- Since:
- 5.2
- See Also:
SessionFactoryBuilder.allowOutOfTransactionUpdateOperations(boolean)
, Constant Field Values
-
AUTO_CLOSE_SESSION
static final String AUTO_CLOSE_SESSION
When enabled, specifies that theSession
should be closed automatically at the end of each transaction.- See Also:
SessionFactoryBuilder.applyAutoClosing(boolean)
, Constant Field Values- Default Value:
false
-
FLUSH_BEFORE_COMPLETION
static final String FLUSH_BEFORE_COMPLETION
When enabled, specifies that automatic flushing should occur during the JTASynchronization.beforeCompletion()
callback.- See Also:
SessionFactoryBuilder.applyAutoFlushing(boolean)
, Constant Field Values- Default Value:
true
unless using JPA bootstrap
-
-