org.springframework.transaction
Interface SavepointManager

All Known Subinterfaces:
TransactionStatus
All Known Implementing Classes:
DefaultTransactionStatus, JdbcTransactionObjectSupport

public interface SavepointManager

Interface that specifies means to programmatically manage transaction savepoints in a generic fashion.

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.

Since:
1.1
Author:
Juergen Hoeller
See Also:
TransactionDefinition.PROPAGATION_NESTED, Savepoint

Method Summary
 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.
 

Method Detail

createSavepoint

public Object createSavepoint()
                       throws TransactionException
Create a new savepoint. You can roll back to a specific savepoint via rollbackToSavepoint, and explicitly release a savepoint that you don't need anymore via releaseSavepoint.

Note that most transaction managers will automatically release savepoints at transaction completion.

Returns:
a savepoint object, to be passed into rollbackToSavepoint or releaseSavepoint
Throws:
TransactionException - if the savepoint could not be created, either because the backend does not support it or because the transaction is not in an appropriate state
See Also:
Connection.setSavepoint()

rollbackToSavepoint

public void rollbackToSavepoint(Object savepoint)
                         throws TransactionException
Roll back to the given savepoint. The savepoint will be automatically released afterwards.

Parameters:
savepoint - the savepoint to roll back to
Throws:
TransactionException - if the rollback failed
See Also:
Connection.rollback(java.sql.Savepoint)

releaseSavepoint

public void releaseSavepoint(Object savepoint)
                      throws TransactionException
Explicitly release the given savepoint.

Note that most transaction managers will automatically release savepoints at transaction completion.

Implementations should fail as silently as possible if proper resource cleanup will still happen at transaction completion.

Parameters:
savepoint - the savepoint to release
Throws:
TransactionException - if the release failed
See Also:
Connection.releaseSavepoint(java.sql.Savepoint)


Copyright (C) 2003-2004 The Spring Framework Project.