接口 SavepointManager
- 所有已知子接口:
TransactionStatus
- 所有已知实现类:
AbstractTransactionStatus
,DefaultTransactionStatus
,JdbcTransactionObjectSupport
,SimpleTransactionStatus
public interface SavepointManager
Interface that specifies an API to programmatically manage transaction savepoints in a generic fashion. Extended by TransactionStatus to expose savepoint management functionality for a specific transaction.Note that savepoints can only work within an active transaction. Just use this programmatic savepoint handling for advanced needs; else, a subtransaction with PROPAGATION_NESTED is preferable.
This interface is inspired by JDBC 3.0's Savepoint mechanism but is independent from any specific persistence technology.
- 从以下版本开始:
- 1.1
- 作者:
- Juergen Hoeller
- 另请参阅:
TransactionStatus
,TransactionDefinition.PROPAGATION_NESTED
,Savepoint
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 Object
createSavepoint()
Create a new savepoint.void
releaseSavepoint(Object savepoint)
Explicitly release the given savepoint.void
rollbackToSavepoint(Object savepoint)
Roll back to the given savepoint.
方法详细资料
createSavepoint
Object createSavepoint() throws TransactionException
Create a new savepoint. You can roll back to a specific savepoint viarollbackToSavepoint
, and explicitly release a savepoint that you don't need anymore viareleaseSavepoint
.Note that most transaction managers will automatically release savepoints at transaction completion.
- 返回:
- a savepoint object, to be passed into
rollbackToSavepoint(java.lang.Object)
orreleaseSavepoint(java.lang.Object)
- 抛出:
NestedTransactionNotSupportedException
- if the underlying transaction does not support savepointsTransactionException
- if the savepoint could not be created, for example because the transaction is not in an appropriate state- 另请参阅:
Connection.setSavepoint()
rollbackToSavepoint
void rollbackToSavepoint(Object savepoint) throws TransactionException
Roll back to the given savepoint.The savepoint will not be automatically released afterwards. You may explicitly call
releaseSavepoint(Object)
or rely on automatic release on transaction completion.- 参数:
savepoint
- the savepoint to roll back to- 抛出:
NestedTransactionNotSupportedException
- if the underlying transaction does not support savepointsTransactionException
- if the rollback failed- 另请参阅:
Connection.rollback(java.sql.Savepoint)
releaseSavepoint
void releaseSavepoint(Object savepoint) throws TransactionException
Explicitly release the given savepoint.Note that most transaction managers will automatically release savepoints on transaction completion.
Implementations should fail as silently as possible if proper resource cleanup will eventually happen at transaction completion.
- 参数:
savepoint
- the savepoint to release- 抛出:
NestedTransactionNotSupportedException
- if the underlying transaction does not support savepointsTransactionException
- if the release failed- 另请参阅:
Connection.releaseSavepoint(java.sql.Savepoint)