@Internal 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.
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()
Retrieves the connection holder.
|
protected ConnectionHolder |
getConnectionHolderForSavepoint() |
TransactionDefinition.Isolation |
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)
Sets the connection holder.
|
void |
setPreviousIsolationLevel(TransactionDefinition.Isolation previousIsolationLevel)
Sets the previous isolation level.
|
void |
setSavepointAllowed(boolean savepointAllowed)
Sets whether save points are allowed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisRollbackOnlypublic void setConnectionHolder(@Nullable
ConnectionHolder connectionHolder)
connectionHolder - The connection holder@NonNull public ConnectionHolder getConnectionHolder()
public boolean hasConnectionHolder()
public void setPreviousIsolationLevel(@Nullable
TransactionDefinition.Isolation previousIsolationLevel)
previousIsolationLevel - The isolation level@Nullable public TransactionDefinition.Isolation getPreviousIsolationLevel()
public void setSavepointAllowed(boolean savepointAllowed)
savepointAllowed - True if they are allowedpublic boolean isSavepointAllowed()
public void flush()
SmartTransactionObjectflush in interface SmartTransactionObjectflush in interface java.io.Flushablepublic java.lang.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(java.lang.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(java.lang.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 - If an error occurs retrieving the connection holder