Package org.hibernate.cfg
Interface TransactionSettings
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
public interface TransactionSettings
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhen enabled, allows access to theTransactioneven when using a JTA for transaction management.static final StringWhen enabled, allows update operations outside a transaction.static final StringWhen enabled, specifies that theSessionshould be closed automatically at the end of each transaction.static final StringAllows 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 final StringWhen enabled, specifies that automatic flushing should occur during the JTASynchronization.beforeCompletion()callback.static final StringWhen enabled, indicates that it is safe to cacheTransactionManagerreferences in theJtaPlatformstatic final StringWhen enabled, indicates that it is safe to cacheUserTransactionreferences in theJtaPlatformstatic final StringSpecifies theJtaPlatformimplementation to use for integrating with JTA, either: an instance ofJtaPlatform, or the name of a class that implementsJtaPlatform.static final StringSpecifies aJtaPlatformResolverimplementation that should be used to obtain an instance ofJtaPlatform.static final StringA transaction can be rolled back by another thread ("tracking by thread") -- not the original application.static final StringWhen enabled, specifies that theUserTransactionshould be used in preference to theTransactionManagerfor JTA transaction management.static final StringSpecify theTransactionCoordinatorBuilderimplementation to use for creating instances ofTransactionCoordinatorwhich the interface Hibernate uses to manage transactions.
-
Field Details
-
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:
- 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
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:
- an instance of
-
JTA_PLATFORM_RESOLVER
Specifies aJtaPlatformResolverimplementation that should be used to obtain an instance ofJtaPlatform.- Since:
- 4.3
- See Also:
-
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:
- Default Value:
falseasTransactionManageris preferred.
-
JTA_CACHE_TM
When enabled, indicates that it is safe to cacheTransactionManagerreferences in theJtaPlatform- Since:
- 4.0
- See Also:
- Default Value:
- Generally
true, thoughJtaPlatformimplementations can do their own thing.
-
JTA_CACHE_UT
When enabled, indicates that it is safe to cacheUserTransactionreferences in theJtaPlatform- Since:
- 4.0
- See Also:
- Default Value:
- Generally
true, thoughJtaPlatformimplementations can do their own thing.
-
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:
- Default Value:
true(enabled).
-
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:
- Default Value:
falsewhen bootstrapped via JPA;trueotherwise.
-
AUTO_CLOSE_SESSION
When enabled, specifies that theSessionshould be closed automatically at the end of each transaction.- See Also:
- Default Value:
false
-
FLUSH_BEFORE_COMPLETION
When enabled, specifies that automatic flushing should occur during the JTASynchronization.beforeCompletion()callback.- See Also:
- Default Value:
trueunless using JPA bootstrap
-
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:
- API Note:
- Generally speaking, all access to transactional data should be done in a transaction. Use of this setting is discouraged.
- Default Value:
false(disabled)
-
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:
- API Note:
- Generally speaking, all access to transactional data should be done in a transaction. Combining this with second-level caching is not safe. Use of this setting is discouraged.
- Default Value:
false(disabled)
-