org.springframework.jdbc.datasource
Class JdbcTransactionObjectSupport
java.lang.Object
org.springframework.jdbc.datasource.JdbcTransactionObjectSupport
- All Implemented Interfaces:
- SavepointManager, SmartTransactionObject
public abstract class JdbcTransactionObjectSupport
- extends Object
- implements SavepointManager, SmartTransactionObject
Convenient base class for JDBC-aware transaction objects.
Can contain a ConnectionHolder, and implements the SavepointManager
interface based on that ConnectionHolder.
Implements the SavepointManager interface to allow for programmatic
management of JDBC 3.0 Savepoints. DefaultTransactionStatus will
automatically delegate to this, as it auto-detects transaction objects
that implement the SavepointManager interface.
Note that savepoints are only supported for JDBC 3.0.
- Since:
- 1.1
- Author:
- Juergen Hoeller
- See Also:
Savepoint
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected static final Log logger
JdbcTransactionObjectSupport
public JdbcTransactionObjectSupport()
setConnectionHolder
public void setConnectionHolder(ConnectionHolder connectionHolder)
getConnectionHolder
public ConnectionHolder getConnectionHolder()
hasConnectionHolder
public boolean hasConnectionHolder()
setPreviousIsolationLevel
public void setPreviousIsolationLevel(Integer previousIsolationLevel)
getPreviousIsolationLevel
public Integer getPreviousIsolationLevel()
setSavepointAllowed
public void setSavepointAllowed(boolean savepointAllowed)
isSavepointAllowed
public boolean isSavepointAllowed()
createSavepoint
public Object createSavepoint()
throws TransactionException
- This implementation creates a JDBC 3.0 Savepoint and returns it.
- Specified by:
createSavepoint
in interface SavepointManager
- Returns:
- a savepoint object, to be passed into rollbackToSavepoint
or releaseSavepoint
- Throws:
TransactionException
- if the savepoint could not be created,
either because the backend does not support it or because the
transaction is not in an appropriate state- See Also:
Connection.setSavepoint()
rollbackToSavepoint
public void rollbackToSavepoint(Object savepoint)
throws TransactionException
- This implementation rolls back to the given JDBC 3.0 Savepoint.
- Specified by:
rollbackToSavepoint
in interface SavepointManager
- Parameters:
savepoint
- the savepoint to roll back to
- Throws:
TransactionException
- if the rollback failed- See Also:
Connection.rollback(java.sql.Savepoint)
releaseSavepoint
public void releaseSavepoint(Object savepoint)
throws TransactionException
- This implementation releases the given JDBC 3.0 Savepoint.
- Specified by:
releaseSavepoint
in interface SavepointManager
- Parameters:
savepoint
- the savepoint to release
- Throws:
TransactionException
- if the release failed- See Also:
Connection.releaseSavepoint(java.sql.Savepoint)
getConnectionHolderForSavepoint
protected ConnectionHolder getConnectionHolderForSavepoint()
throws TransactionException
- Throws:
TransactionException
Copyright (c) 2002-2005 The Spring Framework Project.