Enum Class TransactionDefinition.Propagation
- All Implemented Interfaces:
Serializable, Comparable<TransactionDefinition.Propagation>, Constable
- Enclosing interface:
TransactionDefinition
jakarta.transaction.Transactional.TxType), plus NESTED.- Since:
- 08.05.2003
- Author:
- Juergen Hoeller, graemerocher
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionJoin the current transaction; fail withIllegalTransactionStateExceptionif none is active.If a transaction is active, run in a nested transaction backed by a savepoint of the current transaction; otherwise behave likeREQUIRED.Run without a transaction; fail with aTransactionUsageExceptionif a transaction is active.Run without a transaction, suspending the current transaction (if any) until the work completes.Join the current transaction; start a new one if none is active.Always start a new, independent transaction on a new connection, suspending the current transaction (if any) until the new one completes.Join the current transaction if one is active; otherwise run without a transaction. -
Method Summary
Modifier and TypeMethodDescriptionReturns the enum constant of this class with the specified name.static TransactionDefinition.Propagation[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
REQUIRED
Join the current transaction; start a new one if none is active. This is the default.When the work joins an existing transaction, it shares that transaction's connection, and commit or rollback happens when the outermost transactional scope completes. A failure that causes a rollback in the joined scope marks the whole transaction rollback-only.
-
SUPPORTS
Join the current transaction if one is active; otherwise run without a transaction.Without a transaction, the statements are not grouped into a transaction, but the same connection (or session) is still used for the whole scope.
-
MANDATORY
Join the current transaction; fail withIllegalTransactionStateExceptionif none is active. -
REQUIRES_NEW
Always start a new, independent transaction on a new connection, suspending the current transaction (if any) until the new one completes. The new transaction commits or rolls back independently of the suspended one, and has its ownsynchronizations. -
NOT_SUPPORTED
Run without a transaction, suspending the current transaction (if any) until the work completes. -
NEVER
Run without a transaction; fail with aTransactionUsageExceptionif a transaction is active. -
NESTED
If a transaction is active, run in a nested transaction backed by a savepoint of the current transaction; otherwise behave likeREQUIRED.Rolling back the nested transaction only rolls back to the savepoint, so the outer transaction can continue; committing it releases the savepoint, and its changes become permanent only when the outer transaction commits. Nested transactions require a transaction manager that supports savepoints, such as the JDBC and Hibernate transaction managers, and fail with
NestedTransactionNotSupportedExceptionotherwise.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-