public interface

TransactionStatus

implements SavepointManager
org.springframework.transaction.TransactionStatus
Known Indirect Subclasses

Class Overview

Representation of the status of a transaction.

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 only available if supported by the underlying transaction manager.

Summary

Public Methods
abstract void flush()
Flush the underlying session to the datastore, if applicable: for example, all affected Hibernate/JPA sessions.
abstract boolean hasSavepoint()
Return whether this transaction internally carries a savepoint, that is, has been created as nested transaction based on a savepoint.
abstract boolean isCompleted()
Return whether this transaction is completed, that is, whether it has already been committed or rolled back.
abstract boolean isNewTransaction()
Return whether the present transaction is new (else participating in an existing transaction, or potentially not running in an actual transaction in the first place).
abstract boolean isRollbackOnly()
Return whether the transaction has been marked as rollback-only (either by the application or by the transaction infrastructure).
abstract void setRollbackOnly()
Set the transaction rollback-only.
[Expand]
Inherited Methods
From interface org.springframework.transaction.SavepointManager

Public Methods

public abstract void flush ()

Flush the underlying session to the datastore, if applicable: for example, all affected Hibernate/JPA sessions.

public abstract boolean hasSavepoint ()

Return whether this transaction internally carries a savepoint, that is, 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.

public abstract boolean isCompleted ()

Return whether this transaction is completed, that is, whether it has already been committed or rolled back.

public abstract boolean isNewTransaction ()

Return whether the present transaction is new (else participating in an existing transaction, or potentially not running in an actual transaction in the first place).

public abstract boolean isRollbackOnly ()

Return whether the transaction has been marked as rollback-only (either by the application or by the transaction infrastructure).

public abstract void setRollbackOnly ()

Set the transaction rollback-only. This instructs the transaction manager that the only possible outcome of the transaction may be a rollback, as alternative to throwing an exception which would in turn trigger a rollback.

This is mainly intended for transactions managed by TransactionTemplate or TransactionInterceptor, where the actual commit/rollback decision is made by the container.