|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.transaction.support.ResourceHolderSupport org.springframework.jdbc.datasource.ConnectionHolder
public class ConnectionHolder
Connection holder, wrapping a JDBC Connection. DataSourceTransactionManager binds instances of this class to the thread, for a given 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.
DataSourceTransactionManager
,
DataSourceUtils
Constructor Summary | |
---|---|
ConnectionHolder(Connection connection)
Create a new ConnectionHolder for the given JDBC Connection, wrapping it with a SimpleConnectionHandle. |
|
ConnectionHolder(ConnectionHandle connectionHandle)
Create a new ConnectionHolder for the given ConnectionHandle. |
Method Summary | |
---|---|
Connection |
getConnection()
Return the current Connection held by this ConnectionHolder. |
ConnectionHandle |
getConnectionHandle()
Return the ConnectionHandle held by this ConnectionHolder. |
void |
released()
Releases the current Connection held by this ConnectionHolder. |
Methods inherited from class org.springframework.transaction.support.ResourceHolderSupport |
---|
clear, getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, requested, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionHolder(ConnectionHandle connectionHandle)
connectionHandle
- the ConnectionHandle to holdpublic ConnectionHolder(Connection connection)
connection
- the JDBC Connection to holdSimpleConnectionHandle
Method Detail |
---|
public ConnectionHandle getConnectionHandle()
public Connection getConnection()
This will be the same Connection until released
gets called on the ConnectionHolder, which will reset the
held Connection, fetching a new Connection on demand.
ConnectionHandle.getConnection()
,
released()
public void released()
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.
released
in class ResourceHolderSupport
DefaultJdoDialect.getJdbcConnection(javax.jdo.PersistenceManager, boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |