public abstract class JdbcTransactionObjectSupport extends Object implements SavepointManager, SmartTransactionObject
ConnectionHolder
, and implements the
SavepointManager
interface based on that ConnectionHolder.
Allows for programmatic management of JDBC 3.0
Savepoints
. Spring's
DefaultTransactionStatus
will automatically delegate to this, as it autodetects transaction
objects that implement the SavepointManager interface.
Constructor and Description |
---|
JdbcTransactionObjectSupport() |
Modifier and Type | Method and Description |
---|---|
Object |
createSavepoint()
This implementation creates a JDBC 3.0 Savepoint and returns it.
|
void |
flush()
Flush the underlying sessions to the datastore, if applicable:
for example, all affected Hibernate/JPA sessions.
|
ConnectionHolder |
getConnectionHolder() |
protected ConnectionHolder |
getConnectionHolderForSavepoint() |
Integer |
getPreviousIsolationLevel() |
boolean |
hasConnectionHolder() |
boolean |
isSavepointAllowed() |
void |
releaseSavepoint(Object savepoint)
This implementation releases the given JDBC 3.0 Savepoint.
|
void |
rollbackToSavepoint(Object savepoint)
This implementation rolls back to the given JDBC 3.0 Savepoint.
|
void |
setConnectionHolder(ConnectionHolder connectionHolder) |
void |
setPreviousIsolationLevel(Integer previousIsolationLevel) |
void |
setSavepointAllowed(boolean savepointAllowed) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isRollbackOnly
public void setConnectionHolder(ConnectionHolder connectionHolder)
public ConnectionHolder getConnectionHolder()
public boolean hasConnectionHolder()
public void setPreviousIsolationLevel(Integer previousIsolationLevel)
public Integer getPreviousIsolationLevel()
public void setSavepointAllowed(boolean savepointAllowed)
public boolean isSavepointAllowed()
public void flush()
SmartTransactionObject
flush
in interface Flushable
flush
in interface SmartTransactionObject
public Object createSavepoint() throws TransactionException
createSavepoint
in interface SavepointManager
SavepointManager.rollbackToSavepoint(java.lang.Object)
or SavepointManager.releaseSavepoint(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 stateConnection.setSavepoint()
public void rollbackToSavepoint(Object savepoint) throws TransactionException
rollbackToSavepoint
in interface SavepointManager
savepoint
- the savepoint to roll back toNestedTransactionNotSupportedException
- if the underlying
transaction does not support savepointsTransactionException
- if the rollback failedConnection.rollback(java.sql.Savepoint)
public void releaseSavepoint(Object savepoint) throws TransactionException
releaseSavepoint
in interface SavepointManager
savepoint
- the savepoint to releaseNestedTransactionNotSupportedException
- if the underlying
transaction does not support savepointsTransactionException
- if the release failedConnection.releaseSavepoint(java.sql.Savepoint)
protected ConnectionHolder getConnectionHolderForSavepoint() throws TransactionException
TransactionException