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

public abstract Class AbstractTransactionStatus

extends Object
implements TransactionStatus
Class Inheritance
All Implemented Interfaces
org.springframework.transaction.TransactionStatus, java.io.Flushable, org.springframework.transaction.SavepointManager, org.springframework.transaction.TransactionExecution
Known Direct Subclasses
org.springframework.transaction.support.DefaultTransactionStatus, org.springframework.transaction.support.SimpleTransactionStatus
Imports
org.springframework.lang.Nullable, org.springframework.transaction.NestedTransactionNotSupportedException, .SavepointManager, .TransactionException, .TransactionStatus, .TransactionUsageException

Abstract base implementation of the org.springframework.transaction.TransactionStatus interface.

Pre-implements the handling of local rollback-only and completed flags, and delegation to an underlying org.springframework.transaction.SavepointManager. Also offers the option of a holding a savepoint within the transaction.

Does not assume any specific internal transaction handling, such as an underlying transaction object, and no transaction synchronization mechanism.

Author
Juergen Hoeller
Since
1.2.3
See Also
setRollbackOnly(), isRollbackOnly(), setCompleted(), isCompleted(), getSavepointManager(), SimpleTransactionStatus, DefaultTransactionStatus

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private Object

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
createAndHoldSavepoint()

Create a savepoint and hold it for the transaction.

public Object
createSavepoint()

Implements org.springframework.transaction.SavepointManager.createSavepoint.

This implementation delegates to a SavepointManager for the underlying transaction, if possible.

protected Object
getSavepoint()

Get the savepoint for this transaction, if any.

protected SavepointManager
getSavepointManager()

Return a SavepointManager for the underlying transaction, if possible.

public boolean
hasSavepoint()

Overrides default org.springframework.transaction.TransactionStatus.hasSavepoint.

Return whether this transaction internally carries a savepoint, that is, has been created as nested transaction based on a savepoint.

public boolean
isCompleted()

Overrides default org.springframework.transaction.TransactionExecution.isCompleted.

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

public boolean
isGlobalRollbackOnly()

Template method for determining the global rollback-only flag of the underlying transaction, if any.

public boolean
isLocalRollbackOnly()

Determine the rollback-only flag via checking this TransactionStatus.

public boolean
isRollbackOnly()

Overrides default org.springframework.transaction.TransactionExecution.isRollbackOnly.

Determine the rollback-only flag via checking both the local rollback-only flag of this TransactionStatus and the global rollback-only flag of the underlying transaction, if any.

public void
releaseHeldSavepoint()

Release the savepoint that is held for the transaction.

public void
releaseSavepoint(Object
the savepoint to release
savepoint
)

Implements org.springframework.transaction.SavepointManager.releaseSavepoint.

This implementation delegates to a SavepointManager for the underlying transaction, if possible.

public void
rollbackToHeldSavepoint()

Roll back to the savepoint that is held for the transaction and release the savepoint right afterwards.

public void
rollbackToSavepoint(Object
the savepoint to roll back to
savepoint
)

Implements org.springframework.transaction.SavepointManager.rollbackToSavepoint.

This implementation delegates to a SavepointManager for the underlying transaction, if possible.

public void
setCompleted()

Mark this transaction as completed, that is, committed or rolled back.

public void
setRollbackOnly()

Overrides default org.springframework.transaction.TransactionExecution.setRollbackOnly.

Set the transaction rollback-only.

protected void
setSavepoint(Object savepoint)

Set a savepoint for this transaction.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

completedback to summary
private boolean completed
rollbackOnlyback to summary
private boolean rollbackOnly
savepointback to summary
private Object savepoint
Annotations
@Nullable

Constructor Detail

AbstractTransactionStatusback to summary
public AbstractTransactionStatus()

Method Detail

createAndHoldSavepointback to summary
public void createAndHoldSavepoint() throws TransactionException

Create a savepoint and hold it for the transaction.

Exceptions
NestedTransactionNotSupportedException:
if the underlying transaction does not support savepoints
createSavepointback to summary
public Object createSavepoint() throws TransactionException

Implements org.springframework.transaction.SavepointManager.createSavepoint.

This implementation delegates to a SavepointManager for the underlying transaction, if possible.

Returns:Object

Doc from org.springframework.transaction.SavepointManager.createSavepoint.

a savepoint object, to be passed into rollbackToSavepoint or releaseSavepoint

Annotations
@Override
Exceptions
TransactionException:

Doc from org.springframework.transaction.SavepointManager.createSavepoint.

if the savepoint could not be created, for example because the transaction is not in an appropriate state

See Also
getSavepointManager(), SavepointManager#createSavepoint()
getSavepointback to summary
protected Object getSavepoint()

Get the savepoint for this transaction, if any.

Annotations
@Nullable
getSavepointManagerback to summary
protected SavepointManager getSavepointManager()

Return a SavepointManager for the underlying transaction, if possible.

Default implementation always throws a NestedTransactionNotSupportedException.

Exceptions
NestedTransactionNotSupportedException:
if the underlying transaction does not support savepoints
hasSavepointback to summary
public boolean hasSavepoint()

Overrides default org.springframework.transaction.TransactionStatus.hasSavepoint.

Doc from org.springframework.transaction.TransactionStatus.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 the operations provided by SavepointManager.

The default implementation returns false.

Annotations
@Override
isCompletedback to summary
public boolean isCompleted()

Overrides default org.springframework.transaction.TransactionExecution.isCompleted.

Doc from org.springframework.transaction.TransactionExecution.isCompleted.

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

The default implementation returns false.

Annotations
@Override
isGlobalRollbackOnlyback to summary
public boolean isGlobalRollbackOnly()

Template method for determining the global rollback-only flag of the underlying transaction, if any.

This implementation always returns false.

isLocalRollbackOnlyback to summary
public boolean isLocalRollbackOnly()

Determine the rollback-only flag via checking this TransactionStatus.

Will only return "true" if the application called setRollbackOnly on this TransactionStatus object.

isRollbackOnlyback to summary
public boolean isRollbackOnly()

Overrides default org.springframework.transaction.TransactionExecution.isRollbackOnly.

Determine the rollback-only flag via checking both the local rollback-only flag of this TransactionStatus and the global rollback-only flag of the underlying transaction, if any.

Annotations
@Override
See Also
isLocalRollbackOnly(), isGlobalRollbackOnly()
releaseHeldSavepointback to summary
public void releaseHeldSavepoint() throws TransactionException

Release the savepoint that is held for the transaction.

releaseSavepointback to summary
public void releaseSavepoint(Object savepoint) throws TransactionException

Implements org.springframework.transaction.SavepointManager.releaseSavepoint.

This implementation delegates to a SavepointManager for the underlying transaction, if possible.

Parameters
savepoint:Object

Doc from org.springframework.transaction.SavepointManager.releaseSavepoint.

the savepoint to release

Annotations
@Override
Exceptions
TransactionException:

Doc from org.springframework.transaction.SavepointManager.releaseSavepoint.

if the release failed

See Also
getSavepointManager(), SavepointManager#releaseSavepoint(Object)
rollbackToHeldSavepointback to summary
public void rollbackToHeldSavepoint() throws TransactionException

Roll back to the savepoint that is held for the transaction and release the savepoint right afterwards.

rollbackToSavepointback to summary
public void rollbackToSavepoint(Object savepoint) throws TransactionException

Implements org.springframework.transaction.SavepointManager.rollbackToSavepoint.

This implementation delegates to a SavepointManager for the underlying transaction, if possible.

Parameters
savepoint:Object

Doc from org.springframework.transaction.SavepointManager.rollbackToSavepoint.

the savepoint to roll back to

Annotations
@Override
Exceptions
TransactionException:

Doc from org.springframework.transaction.SavepointManager.rollbackToSavepoint.

if the rollback failed

See Also
getSavepointManager(), SavepointManager#rollbackToSavepoint(Object)
setCompletedback to summary
public void setCompleted()

Mark this transaction as completed, that is, committed or rolled back.

setRollbackOnlyback to summary
public void setRollbackOnly()

Overrides default org.springframework.transaction.TransactionExecution.setRollbackOnly.

Doc from org.springframework.transaction.TransactionExecution.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.

The default implementation throws an UnsupportedOperationException.

Annotations
@Override
setSavepointback to summary
protected void setSavepoint(Object savepoint)

Set a savepoint for this transaction. Useful for PROPAGATION_NESTED.

See Also
org.springframework.transaction.TransactionDefinition#PROPAGATION_NESTED