Class JdbcTransactionObjectSupport
java.lang.Object
org.springframework.jdbc.datasource.JdbcTransactionObjectSupport
- All Implemented Interfaces:
- Flushable, SavepointManager, SmartTransactionObject
public abstract class JdbcTransactionObjectSupport
extends Object
implements SavepointManager, SmartTransactionObject
Convenient base class for JDBC-aware transaction objects. Can contain a
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.
- Since:
- 1.1
- Author:
- Juergen Hoeller
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionThis implementation creates a JDBC Savepoint and returns it.Return the ConnectionHolder for this transaction object.protected ConnectionHolderReturn the retained previous isolation level, if any.booleanCheck whether this transaction object has a ConnectionHolder.booleanReturn the read-only status of this transaction.booleanReturn whether savepoints are allowed within this transaction.voidreleaseSavepoint(Object savepoint) This implementation releases the given JDBC Savepoint.voidrollbackToSavepoint(Object savepoint) This implementation rolls back to the given JDBC Savepoint.voidsetConnectionHolder(@Nullable ConnectionHolder connectionHolder) Set the ConnectionHolder for this transaction object.voidsetPreviousIsolationLevel(@Nullable Integer previousIsolationLevel) Set the previous isolation level to retain, if any.voidsetReadOnly(boolean readOnly) Set the read-only status of this transaction.voidsetSavepointAllowed(boolean savepointAllowed) Set whether savepoints are allowed within this transaction.Methods inherited from class Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface SmartTransactionObjectflush, isRollbackOnly
- 
Constructor Details- 
JdbcTransactionObjectSupportpublic JdbcTransactionObjectSupport()
 
- 
- 
Method Details- 
setConnectionHolderSet the ConnectionHolder for this transaction object.
- 
getConnectionHolderReturn the ConnectionHolder for this transaction object.
- 
hasConnectionHolderpublic boolean hasConnectionHolder()Check whether this transaction object has a ConnectionHolder.
- 
setPreviousIsolationLevel
- 
getPreviousIsolationLevel
- 
setReadOnlypublic void setReadOnly(boolean readOnly) Set the read-only status of this transaction. The default isfalse.- Since:
- 5.2.1
 
- 
isReadOnlypublic boolean isReadOnly()Return the read-only status of this transaction.- Since:
- 5.2.1
 
- 
setSavepointAllowedpublic void setSavepointAllowed(boolean savepointAllowed) Set whether savepoints are allowed within this transaction. The default isfalse.
- 
isSavepointAllowedpublic boolean isSavepointAllowed()Return whether savepoints are allowed within this transaction.
- 
createSavepointThis implementation creates a JDBC Savepoint and returns it.- Specified by:
- createSavepointin interface- SavepointManager
- Returns:
- a savepoint object, to be passed into
SavepointManager.rollbackToSavepoint(Object)orSavepointManager.releaseSavepoint(Object)
- Throws:
- TransactionException- if the savepoint could not be created, for example because the transaction is not in an appropriate state
- See Also:
 
- 
rollbackToSavepointThis implementation rolls back to the given JDBC Savepoint.- Specified by:
- rollbackToSavepointin interface- SavepointManager
- Parameters:
- savepoint- the savepoint to roll back to
- Throws:
- TransactionException- if the rollback failed
- See Also:
 
- 
releaseSavepointThis implementation releases the given JDBC Savepoint.- Specified by:
- releaseSavepointin interface- SavepointManager
- Parameters:
- savepoint- the savepoint to release
- Throws:
- TransactionException- if the release failed
- See Also:
 
- 
getConnectionHolderForSavepoint- Throws:
- TransactionException
 
 
-