org.springframework.transaction
Interface TransactionStatus

All Superinterfaces:
SavepointManager
All Known Implementing Classes:
AbstractTransactionStatus, DefaultTransactionStatus, SimpleTransactionStatus

public interface TransactionStatus
extends SavepointManager

Representation of the status of a transaction, consisting of a transaction object and some status flags.

Transactional code can use this to retrieve status information, and to programmatically request a rollback (instead of throwing an exception that causes an implicit rollback).

Derives from the SavepointManager interface to provide access to savepoint management facilities. Note that savepoint management is just available if the actual transaction manager supports it.

Since:
27.03.2003
Author:
Juergen Hoeller
See Also:
PlatformTransactionManager, TransactionCallback.doInTransaction(org.springframework.transaction.TransactionStatus), TransactionAspectSupport.currentTransactionStatus(), setRollbackOnly()

Method Summary
 boolean hasSavepoint()
          Return whether this transaction internally carries a savepoint, i.e. has been created as nested transaction based on a savepoint.
 boolean isCompleted()
          Return whether this transaction is completed, that is, has already been committed or rolled back.
 boolean isNewTransaction()
          Return if the transaction is new, else participating in an existing transaction.
 boolean isRollbackOnly()
          Return if the transaction has been set rollback-only.
 void setRollbackOnly()
          Set the transaction rollback-only.
 
Methods inherited from interface org.springframework.transaction.SavepointManager
createSavepoint, releaseSavepoint, rollbackToSavepoint
 

Method Detail

isNewTransaction

boolean isNewTransaction()
Return if the transaction is new, else participating in an existing transaction.


hasSavepoint

boolean hasSavepoint()
Return whether this transaction internally carries a savepoint, i.e. has been created as nested transaction based on a savepoint.

This method is mainly here for diagnostic purposes, alongside isNewTransaction. For programmatic handling of custom savepoints, use SavepointManager's operations.

See Also:
isNewTransaction(), SavepointManager.createSavepoint(), SavepointManager.rollbackToSavepoint(Object), SavepointManager.releaseSavepoint(Object)

setRollbackOnly

void setRollbackOnly()
Set the transaction rollback-only. This instructs the transaction manager that the only possible outcome of the transaction may be a rollback, proceeding with the normal applicaiton workflow though (i.e. no exception).

For transactions managed by TransactionTemplate or TransactionInterceptor. An alternative way to trigger a rollback is throwing an application exception.

See Also:
TransactionCallback.doInTransaction(org.springframework.transaction.TransactionStatus), TransactionAttribute.rollbackOn(java.lang.Throwable)

isRollbackOnly

boolean isRollbackOnly()
Return if the transaction has been set rollback-only.


isCompleted

boolean isCompleted()
Return whether this transaction is completed, that is, has already been committed or rolled back.



Copyright (c) 2002-2005 The Spring Framework Project.