| java.lang.Object org.springframework.transaction.support.ResourceHolderSupport org.springframework.jdbc.datasource.ConnectionHolder
ConnectionHolder | public class ConnectionHolder extends ResourceHolderSupport (Code) | | Connection holder, wrapping a JDBC Connection.
DataSourceTransactionManager binds instances of this class
to the thread, for a specific DataSource.
Inherits rollback-only support for nested JDBC transactions
and reference count functionality from the base class.
Note: This is an SPI class, not intended to be used by applications.
author: Juergen Hoeller since: 06.05.2003 See Also: DataSourceTransactionManager See Also: DataSourceUtils |
Method Summary | |
public void | clear() | public Savepoint | createSavepoint() Create a new JDBC 3.0 Savepoint for the current Connection,
using generated savepoint names that are unique for the Connection. | public Connection | getConnection() Return the current Connection held by this ConnectionHolder. | public ConnectionHandle | getConnectionHandle() Return the ConnectionHandle held by this ConnectionHolder. | protected boolean | hasConnection() Return whether this holder currently has a Connection. | protected boolean | isTransactionActive() Return whether this holder represents an active, JDBC-managed transaction. | public void | released() Releases the current Connection held by this ConnectionHolder.
This is necessary for ConnectionHandles that expect "Connection borrowing",
where each returned Connection is only temporarily leased and needs to be
returned once the data operation is done, to make the Connection available
for other operations within the same transaction. | protected void | setConnection(Connection connection) Override the existing Connection handle with the given Connection. | protected void | setTransactionActive(boolean transactionActive) Set whether this holder represents an active, JDBC-managed transaction. | public boolean | supportsSavepoints() Return whether JDBC 3.0 Savepoints are supported. |
SAVEPOINT_NAME_PREFIX | final public static String SAVEPOINT_NAME_PREFIX(Code) | | |
ConnectionHolder | public ConnectionHolder(ConnectionHandle connectionHandle)(Code) | | Create a new ConnectionHolder for the given ConnectionHandle.
Parameters: connectionHandle - the ConnectionHandle to hold |
ConnectionHolder | public ConnectionHolder(Connection connection, boolean transactionActive)(Code) | | Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a
SimpleConnectionHandle .
Parameters: connection - the JDBC Connection to hold Parameters: transactionActive - whether the given Connection is involvedin an ongoing transaction See Also: SimpleConnectionHandle |
clear | public void clear()(Code) | | |
createSavepoint | public Savepoint createSavepoint() throws SQLException(Code) | | Create a new JDBC 3.0 Savepoint for the current Connection,
using generated savepoint names that are unique for the Connection.
the new Savepoint throws: SQLException - if thrown by the JDBC driver |
getConnectionHandle | public ConnectionHandle getConnectionHandle()(Code) | | Return the ConnectionHandle held by this ConnectionHolder.
|
hasConnection | protected boolean hasConnection()(Code) | | Return whether this holder currently has a Connection.
|
isTransactionActive | protected boolean isTransactionActive()(Code) | | Return whether this holder represents an active, JDBC-managed transaction.
|
released | public void released()(Code) | | Releases the current Connection held by this ConnectionHolder.
This is necessary for ConnectionHandles that expect "Connection borrowing",
where each returned Connection is only temporarily leased and needs to be
returned once the data operation is done, to make the Connection available
for other operations within the same transaction. This is the case with
JDO 2.0 DataStoreConnections, for example.
See Also: org.springframework.orm.jdo.DefaultJdoDialect.getJdbcConnection |
setConnection | protected void setConnection(Connection connection)(Code) | | Override the existing Connection handle with the given Connection.
Reset the handle if given null .
Used for releasing the Connection on suspend (with a null
argument) and setting a fresh Connection on resume.
|
setTransactionActive | protected void setTransactionActive(boolean transactionActive)(Code) | | Set whether this holder represents an active, JDBC-managed transaction.
See Also: DataSourceTransactionManager |
supportsSavepoints | public boolean supportsSavepoints() throws SQLException(Code) | | Return whether JDBC 3.0 Savepoints are supported.
Caches the flag for the lifetime of this ConnectionHolder.
throws: SQLException - if thrown by the JDBC driver |
|
|