接口 TransactionStatus
public interface TransactionStatus extends TransactionExecution, SavepointManager, Flushable
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).
Includes the
SavepointManager
interface to provide access to savepoint management facilities. Note that savepoint management is only available if supported by the underlying transaction manager.- 从以下版本开始:
- 27.03.2003
- 作者:
- Juergen Hoeller
- 另请参阅:
TransactionExecution.setRollbackOnly()
,PlatformTransactionManager.getTransaction(org.springframework.transaction.TransactionDefinition)
,TransactionCallback.doInTransaction(org.springframework.transaction.TransactionStatus)
,TransactionAspectSupport.currentTransactionStatus()
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 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.从接口继承的方法 org.springframework.transaction.SavepointManager
createSavepoint, releaseSavepoint, rollbackToSavepoint
从接口继承的方法 org.springframework.transaction.TransactionExecution
isCompleted, isNewTransaction, isRollbackOnly, setRollbackOnly
方法详细资料
hasSavepoint
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
TransactionExecution.isNewTransaction()
. For programmatic handling of custom savepoints, use the operations provided bySavepointManager
.
flush
void flush()
Flush the underlying session to the datastore, if applicable: for example, all affected Hibernate/JPA sessions.This is effectively just a hint and may be a no-op if the underlying transaction manager does not have a flush concept. A flush signal may get applied to the primary resource or to transaction synchronizations, depending on the underlying resource.