Top Description Fields Constructors Methods
org.springframework.transaction.annotation

public final Enum Propagation

extends Enum<Propagation>
Class Inheritance
Imports
org.springframework.transaction.TransactionDefinition

Enumeration that represents transaction propagation behaviors for use with the Transactional annotation, corresponding to the TransactionDefinition interface.
Authors
Colin Sampaleanu, Juergen Hoeller
Since
1.2

Field Summary

Modifier and TypeField and Description
public static final Propagation
MANDATORY

Support a current transaction, throw an exception if none exists.

public static final Propagation
NESTED

Execute within a nested transaction if a current transaction exists, behave like REQUIRED otherwise.

public static final Propagation
NEVER

Execute non-transactionally, throw an exception if a transaction exists.

public static final Propagation
NOT_SUPPORTED

Execute non-transactionally, suspend the current transaction if one exists.

public static final Propagation
REQUIRED

Support a current transaction, create a new one if none exists.

public static final Propagation
REQUIRES_NEW

Create a new transaction, and suspend the current transaction if one exists.

public static final Propagation
SUPPORTS

Support a current transaction, execute non-transactionally if none exists.

private final int

Constructor Summary

AccessConstructor and Description
private
Propagation(int value)

Method Summary

Modifier and TypeMethod and Description
public int
public static Propagation
public static Propagation[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

MANDATORYback to summary
public static final Propagation MANDATORY

Support a current transaction, throw an exception if none exists. Analogous to EJB transaction attribute of the same name.

NESTEDback to summary
public static final Propagation NESTED

Execute within a nested transaction if a current transaction exists, behave like REQUIRED otherwise. There is no analogous feature in EJB.

Note

Actual creation of a nested transaction will only work on specific transaction managers. Out of the box, this only applies to the JDBC DataSourceTransactionManager. Some JTA providers might support nested transactions as well.

See Also
org.springframework.jdbc.datasource.DataSourceTransactionManager
NEVERback to summary
public static final Propagation NEVER

Execute non-transactionally, throw an exception if a transaction exists. Analogous to EJB transaction attribute of the same name.

NOT_SUPPORTEDback to summary
public static final Propagation NOT_SUPPORTED

Execute non-transactionally, suspend the current transaction if one exists. Analogous to EJB transaction attribute of the same name.

Note

Actual transaction suspension will not work out-of-the-box on all transaction managers. This in particular applies to org.springframework.transaction.jta.JtaTransactionManager, which requires the jakarta.transaction.TransactionManager to be made available to it (which is server-specific in standard Jakarta EE).

See Also
org.springframework.transaction.jta.JtaTransactionManager#setTransactionManager
REQUIREDback to summary
public static final Propagation REQUIRED

Support a current transaction, create a new one if none exists. Analogous to EJB transaction attribute of the same name.

This is the default setting of a transaction annotation.

REQUIRES_NEWback to summary
public static final Propagation REQUIRES_NEW

Create a new transaction, and suspend the current transaction if one exists. Analogous to the EJB transaction attribute of the same name.

Note

Actual transaction suspension will not work out-of-the-box on all transaction managers. This in particular applies to org.springframework.transaction.jta.JtaTransactionManager, which requires the jakarta.transaction.TransactionManager to be made available to it (which is server-specific in standard Jakarta EE).

See Also
org.springframework.transaction.jta.JtaTransactionManager#setTransactionManager
SUPPORTSback to summary
public static final Propagation SUPPORTS

Support a current transaction, execute non-transactionally if none exists. Analogous to EJB transaction attribute of the same name.

Note

For transaction managers with transaction synchronization, SUPPORTS is slightly different from no transaction at all, as it defines a transaction scope that synchronization will apply for. As a consequence, the same resources (JDBC Connection, Hibernate Session, etc) will be shared for the entire specified scope. Note that this depends on the actual synchronization configuration of the transaction manager.

See Also
org.springframework.transaction.support.AbstractPlatformTransactionManager#setTransactionSynchronization
valueback to summary
private final int value

Constructor Detail

Propagationback to summary
private Propagation(int value)

Method Detail

valueback to summary
public int value()
valueOfback to summary
public static Propagation valueOf(String name)
valuesback to summary
public static Propagation[] values()