public final enum

Propagation

extends Enum<E extends Enum<E>>
java.lang.Object
   ↳ java.lang.Enum<E extends java.lang.Enum<E>>
     ↳ org.springframework.transaction.annotation.Propagation

Class Overview

Enumeration that represents transaction propagation behaviors for use with the Transactional annotation, corresponding to the TransactionDefinition interface.

Summary

Enum Values
Propagation  MANDATORY  Support a current transaction, throw an exception if none exists. 
Propagation  NESTED  Execute within a nested transaction if a current transaction exists, behave like PROPAGATION_REQUIRED else. 
Propagation  NEVER  Execute non-transactionally, throw an exception if a transaction exists. 
Propagation  NOT_SUPPORTED  Execute non-transactionally, suspend the current transaction if one exists. 
Propagation  REQUIRED  Support a current transaction, create a new one if none exists. 
Propagation  REQUIRES_NEW  Create a new transaction, suspend the current transaction if one exists. 
Propagation  SUPPORTS  Support a current transaction, execute non-transactionally if none exists. 
Public Methods
int value()
static Propagation valueOf(String name)
final static Propagation[] values()
[Expand]
Inherited Methods
From class java.lang.Enum
From class java.lang.Object
From interface java.lang.Comparable

Enum Values

public static final Propagation MANDATORY

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

public static final Propagation NESTED

Execute within a nested transaction if a current transaction exists, behave like PROPAGATION_REQUIRED else. 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 when working on a JDBC 3.0 driver. Some JTA providers might support nested transactions as well.

public static final Propagation NEVER

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

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 on out-of-the-box on all transaction managers. This in particular applies to JtaTransactionManager, which requires the javax.transaction.TransactionManager to be made available it to it (which is server-specific in standard J2EE).

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.

public static final Propagation REQUIRES_NEW

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

Note: Actual transaction suspension will not work on out-of-the-box on all transaction managers. This in particular applies to JtaTransactionManager, which requires the javax.transaction.TransactionManager to be made available it to it (which is server-specific in standard J2EE).

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, PROPAGATION_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.

Public Methods

public int value ()

public static Propagation valueOf (String name)

public static final Propagation[] values ()