public abstract class JdbcTransactionObjectSupport extends java.lang.Object implements SavepointManager, SmartTransactionObject
ConnectionHolder
with a JDBC Connection
, and implements the
SavepointManager
interface based on that ConnectionHolder
.
Allows for programmatic management of JDBC Savepoints
.
Spring's DefaultTransactionStatus
automatically delegates to this, as it autodetects transaction objects which
implement the SavepointManager
interface.
DataSourceTransactionManager
Constructor and Description |
---|
JdbcTransactionObjectSupport() |
Modifier and Type | Method and Description |
---|---|
java.lang.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() |
java.lang.Integer |
getPreviousIsolationLevel() |
boolean |
hasConnectionHolder() |
boolean |
isSavepointAllowed() |
void |
releaseSavepoint(java.lang.Object savepoint)
This implementation releases the given JDBC 3.0 Savepoint.
|
void |
rollbackToSavepoint(java.lang.Object savepoint)
This implementation rolls back to the given JDBC 3.0 Savepoint.
|
void |
setConnectionHolder(ConnectionHolder connectionHolder) |
void |
setPreviousIsolationLevel(java.lang.Integer previousIsolationLevel) |
void |
setSavepointAllowed(boolean savepointAllowed) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isRollbackOnly
public void setConnectionHolder(@Nullable ConnectionHolder connectionHolder)
public ConnectionHolder getConnectionHolder()
public boolean hasConnectionHolder()
public void setPreviousIsolationLevel(@Nullable java.lang.Integer previousIsolationLevel)
@Nullable public java.lang.Integer getPreviousIsolationLevel()
public void setSavepointAllowed(boolean savepointAllowed)
public boolean isSavepointAllowed()
public void flush()
SmartTransactionObject
flush
in interface java.io.Flushable
flush
in interface SmartTransactionObject
public java.lang.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(java.lang.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(java.lang.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