站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

JdbcTransactionObjectSupport (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.jdbc.datasource
Class JdbcTransactionObjectSupport

java.lang.Object
  extended by 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.

Allows for programmatic management of JDBC 3.0 Savepoints. Spring's DefaultTransactionStatus will automatically delegate to this, as it autodetects transaction objects that implement the SavepointManager interface.

Note that savepoints are only supported for drivers which support JDBC 3.0 or higher.

Since:
1.1
Author:
Juergen Hoeller

Constructor Summary
JdbcTransactionObjectSupport()
           
 
Method Summary
 Object createSavepoint()
          This implementation creates a JDBC 3.0 Savepoint and returns it.
 ConnectionHolder getConnectionHolder()
           
protected  ConnectionHolder getConnectionHolderForSavepoint()
           
 Integer getPreviousIsolationLevel()
           
 boolean hasConnectionHolder()
           
 boolean isSavepointAllowed()
           
 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)
           
 void setPreviousIsolationLevel(Integer previousIsolationLevel)
           
 void setSavepointAllowed(boolean savepointAllowed)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.transaction.support.SmartTransactionObject
isRollbackOnly
 

Constructor Detail

JdbcTransactionObjectSupport

public JdbcTransactionObjectSupport()
Method Detail

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:
NestedTransactionNotSupportedException - if the underlying transaction does not support savepoints
TransactionException - if the savepoint could not be created, for example 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:
NestedTransactionNotSupportedException - if the underlying transaction does not support savepoints
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:
NestedTransactionNotSupportedException - if the underlying transaction does not support savepoints
TransactionException - if the release failed
See Also:
Connection.releaseSavepoint(java.sql.Savepoint)

getConnectionHolderForSavepoint

protected ConnectionHolder getConnectionHolderForSavepoint()
                                                    throws TransactionException
Throws:
TransactionException

The Spring Framework

Copyright © 2002-2007 The Spring Framework.