Package org.hibernate.cfg
Interface TransactionSettings
-
public interface TransactionSettings
-
-
Field Summary
Fields Modifier and Type Field Description static StringALLOW_JTA_TRANSACTION_ACCESSWhen enabled, allows access to theTransactioneven when using a JTA for transaction management.static StringALLOW_UPDATE_OUTSIDE_TRANSACTIONWhen enabled, allows update operations outside a transaction.static StringAUTO_CLOSE_SESSIONWhen enabled, specifies that theSessionshould be closed automatically at the end of each transaction.static StringENABLE_LAZY_LOAD_NO_TRANSAllows 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 StringFLUSH_BEFORE_COMPLETIONWhen enabled, specifies that automatic flushing should occur during the JTASynchronization.beforeCompletion()callback.static StringJTA_CACHE_TMWhen enabled, indicates that it is safe to cacheTransactionManagerreferences in theJtaPlatformstatic StringJTA_CACHE_UTWhen enabled, indicates that it is safe to cacheUserTransactionreferences in theJtaPlatformstatic StringJTA_PLATFORMSpecifies theJtaPlatformimplementation to use for integrating with JTA, either: an instance ofJtaPlatform, or the name of a class that implementsJtaPlatform.static StringJTA_PLATFORM_RESOLVERSpecifies aJtaPlatformResolverimplementation that should be used to obtain an instance ofJtaPlatform.static StringJTA_TRACK_BY_THREADA transaction can be rolled back by another thread ("tracking by thread") -- not the original application.static StringPREFER_USER_TRANSACTIONWhen enabled, specifies that theUserTransactionshould be used in preference to theTransactionManagerfor JTA transaction management.static StringTRANSACTION_COORDINATOR_STRATEGYSpecify theTransactionCoordinatorBuilderimplementation to use for creating instances ofTransactionCoordinatorwhich the interface Hibernate uses to manage transactions.
-
-
-
Field Detail
-
TRANSACTION_COORDINATOR_STRATEGY
static final String TRANSACTION_COORDINATOR_STRATEGY
Specify theTransactionCoordinatorBuilderimplementation to use for creating instances ofTransactionCoordinatorwhich the interface Hibernate uses to manage transactions. Accepts either:- an instance of
TransactionCoordinatorBuilder, - a
Classrepresenting a class that implementsTransactionCoordinatorBuilder, - the name of a class that implements
TransactionCoordinatorBuilder, jtaorjdbc
- Since:
- 5.0
- See Also:
JTA_PLATFORM, Constant Field Values- Implementation Specification:
- With non Jakarta Persistence bootstrapping, Hibernate will use
jdbcas 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 theJtaPlatformimplementation 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 aJtaPlatformResolverimplementation 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 theUserTransactionshould be used in preference to theTransactionManagerfor JTA transaction management.By default, the
TransactionManageris preferred.- Since:
- 5.0
- See Also:
JtaPlatform.retrieveUserTransaction(),JtaPlatform.retrieveTransactionManager(),SessionFactoryBuilder.applyPreferUserTransactions(boolean), Constant Field Values- Default Value:
falseasTransactionManageris preferred.
-
JTA_CACHE_TM
static final String JTA_CACHE_TM
When enabled, indicates that it is safe to cacheTransactionManagerreferences in theJtaPlatform- Since:
- 4.0
- See Also:
- Constant Field Values
- Default Value:
- Generally
true, thoughJtaPlatformimplementations can do their own thing.
-
JTA_CACHE_UT
static final String JTA_CACHE_UT
When enabled, indicates that it is safe to cacheUserTransactionreferences in theJtaPlatform- Since:
- 4.0
- See Also:
- Constant Field Values
- Default Value:
- Generally
true, thoughJtaPlatformimplementations 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 theTransactioneven 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:
falsewhen bootstrapped via JPA;trueotherwise.
-
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 theSessionshould 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:
trueunless using JPA bootstrap
-
-