img
Table 13-2. Propagation Behavior Values
Isolation Level
Description
Supports a transaction if one already exists. If there
TransactionDefinition.PROPAGATION_REQUIRED
is no transaction, it starts a new one.
Supports a transaction if one already exists. If there
TransactionDefinition.PROPAGATION_SUPPORTS
is no transaction, it executes nontransactionally.
Supports a transaction if one already exists. Throws
TransactionDefinition.PROPAGATION_MANDATORY
an exception if there is no active transaction.
Always starts a new transaction. If an active
TransactionDefinition.PROPAGATION_REQUIRES_NEW
transaction already exists, it is suspended.
TransactionDefinition.PROPAGATION_NOT_SUPPORTED Does not support execution with an active
transaction. Always executes nontransactionally
and suspends any existing transaction.
Always executes nontransactionally even if an
TransactionDefinition.PROPAGATION_NEVER
active transaction exists. Throws an exception if an
active transaction exists.
Runs in a nested transaction if an active
TransactionDefinition.PROPAGATION_NESTED
transaction exists. If there is no active transaction,
the execution is executed as if Transaction
Definition.PROPAGATION_REQUIRED is set.
The TransactionStatus Interface
The TransactionStatus interface, shown in Listing 13-2, allows a transactional manager to control the
transaction execution. The code can check whether the transaction is a new one or whether it is a read-
only transaction and it can initiate a rollback.
Listing 13-2. TransactionStatus Declaration
package org.springframework.transaction;
public interface TransactionStatus extends SavepointManager {
boolean isNewTransaction();
boolean hasSavepoint();
void setRollbackOnly();
boolean isRollbackOnly();
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home