Package org.hibernate.cfg
Interface TransactionSettings
- All Known Subinterfaces:
AvailableSettings
- All Known Implementing Classes:
Environment
public interface TransactionSettings
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
When enabled, allows access to theTransaction
even when using a JTA for transaction management.static final String
When enabled, allows update operations outside a transaction.static final String
When enabled, specifies that theSession
should be closed automatically at the end of each transaction.static final String
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 final String
When enabled, specifies that automatic flushing should occur during the JTASynchronization.beforeCompletion()
callback.static final String
When enabled, indicates that it is safe to cacheTransactionManager
references in theJtaPlatform
static final String
When enabled, indicates that it is safe to cacheUserTransaction
references in theJtaPlatform
static final String
Specifies theJtaPlatform
implementation to use for integrating with JTA, either: an instance ofJtaPlatform
, or the name of a class that implementsJtaPlatform
.static final String
Specifies aJtaPlatformResolver
implementation that should be used to obtain an instance ofJtaPlatform
.static final String
A transaction can be rolled back by another thread ("tracking by thread") -- not the original application.static final String
When enabled, specifies that theUserTransaction
should be used in preference to theTransactionManager
for JTA transaction management.static final String
Specify theTransactionCoordinatorBuilder
implementation to use for creating instances ofTransactionCoordinator
which the interface Hibernate uses to manage transactions.
-
Field Details
-
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:
- 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
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:
- an instance of
-
JTA_PLATFORM_RESOLVER
Specifies aJtaPlatformResolver
implementation that should be used to obtain an instance ofJtaPlatform
.- Since:
- 4.3
- See Also:
-
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:
- Default Value:
false
asTransactionManager
is preferred.
-
JTA_CACHE_TM
When enabled, indicates that it is safe to cacheTransactionManager
references in theJtaPlatform
- Since:
- 4.0
- See Also:
- Default Value:
- Generally
true
, thoughJtaPlatform
implementations can do their own thing.
-
JTA_CACHE_UT
When enabled, indicates that it is safe to cacheUserTransaction
references in theJtaPlatform
- Since:
- 4.0
- See Also:
- Default Value:
- Generally
true
, thoughJtaPlatform
implementations 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 theTransaction
even when using a JTA for transaction management.Values are
true
, which grants access, andfalse
, which does not.- See Also:
- Default Value:
false
when bootstrapped via JPA;true
otherwise.
-
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:
- 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.
-
AUTO_CLOSE_SESSION
When enabled, specifies that theSession
should 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:
true
unless using JPA bootstrap
-