public interface TransactionStatus extends SavepointManager, Flushable
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.
setRollbackOnly()
,
PlatformTransactionManager.getTransaction(org.springframework.transaction.TransactionDefinition)
,
TransactionCallback.doInTransaction(org.springframework.transaction.TransactionStatus)
,
TransactionAspectSupport.currentTransactionStatus()
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flush the underlying session to the datastore, if applicable:
for example, all affected Hibernate/JPA sessions.
|
boolean |
hasSavepoint()
Return whether this transaction internally carries a savepoint,
that is, has been created as nested transaction based on a savepoint.
|
boolean |
isCompleted()
Return whether this transaction is completed, that is,
whether it has already been committed or rolled back.
|
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).
|
boolean |
isRollbackOnly()
Return whether the transaction has been marked as rollback-only
(either by the application or by the transaction infrastructure).
|
void |
setRollbackOnly()
Set the transaction rollback-only.
|
createSavepoint, releaseSavepoint, rollbackToSavepoint
boolean isNewTransaction()
boolean hasSavepoint()
This method is mainly here for diagnostic purposes, alongside
isNewTransaction()
. For programmatic handling of custom
savepoints, use SavepointManager's operations.
void setRollbackOnly()
This is mainly intended for transactions managed by
TransactionTemplate
or
TransactionInterceptor
,
where the actual commit/rollback decision is made by the container.
boolean isRollbackOnly()
void flush()
boolean isCompleted()