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

JdbcTransactionObjectSupport (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


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.

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

Field Summary
protected static Log logger
           
 
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
 

Field Detail

logger

protected static final Log logger
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


Copyright (c) 2002-2007 The Spring Framework Project.