public abstract class JdbcTransactionObjectSupport extends 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 |
|---|---|
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()
Return the ConnectionHolder for this transaction object.
|
protected ConnectionHolder |
getConnectionHolderForSavepoint() |
Integer |
getPreviousIsolationLevel()
Return the retained previous isolation level, if any.
|
boolean |
hasConnectionHolder()
Check whether this transaction object has a ConnectionHolder.
|
boolean |
isReadOnly()
Return the read-only status of this transaction.
|
boolean |
isSavepointAllowed()
Return whether savepoints are allowed within this transaction.
|
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)
Set the ConnectionHolder for this transaction object.
|
void |
setPreviousIsolationLevel(Integer previousIsolationLevel)
Set the previous isolation level to retain, if any.
|
void |
setReadOnly(boolean readOnly)
Set the read-only status of this transaction.
|
void |
setSavepointAllowed(boolean savepointAllowed)
Set whether savepoints are allowed within this transaction.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisRollbackOnlypublic void setConnectionHolder(@Nullable ConnectionHolder connectionHolder)
public ConnectionHolder getConnectionHolder()
public boolean hasConnectionHolder()
public void setPreviousIsolationLevel(@Nullable Integer previousIsolationLevel)
@Nullable public Integer getPreviousIsolationLevel()
public void setReadOnly(boolean readOnly)
false.public boolean isReadOnly()
public void setSavepointAllowed(boolean savepointAllowed)
false.public boolean isSavepointAllowed()
public void flush()
SmartTransactionObjectflush in interface Flushableflush in interface SmartTransactionObjectpublic Object createSavepoint() throws TransactionException
createSavepoint in interface SavepointManagerSavepointManager.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 SavepointManagersavepoint - 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 SavepointManagersavepoint - 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