java.lang.Object | ||
↳ | org.springframework.transaction.support.ResourceHolderSupport | |
↳ | org.springframework.jdbc.datasource.ConnectionHolder |
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.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | SAVEPOINT_NAME_PREFIX |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new ConnectionHolder for the given ConnectionHandle.
| |||||||||||
Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a
SimpleConnectionHandle ,
assuming that there is no ongoing transaction. | |||||||||||
Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a
SimpleConnectionHandle . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Clear the transactional state of this resource holder.
| |||||||||||
Create a new JDBC 3.0 Savepoint for the current Connection,
using generated savepoint names that are unique for the Connection.
| |||||||||||
Return the current Connection held by this ConnectionHolder.
| |||||||||||
Return the ConnectionHandle held by this ConnectionHolder.
| |||||||||||
Releases the current Connection held by this ConnectionHolder.
| |||||||||||
Return whether JDBC 3.0 Savepoints are supported.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return whether this holder currently has a Connection.
| |||||||||||
Return whether this holder represents an active, JDBC-managed transaction.
| |||||||||||
Override the existing Connection handle with the given Connection.
| |||||||||||
Set whether this holder represents an active, JDBC-managed transaction.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.springframework.transaction.support.ResourceHolderSupport
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.transaction.support.ResourceHolder
|
Create a new ConnectionHolder for the given ConnectionHandle.
connectionHandle | the ConnectionHandle to hold |
---|
Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a SimpleConnectionHandle
,
assuming that there is no ongoing transaction.
connection | the JDBC Connection to hold |
---|
Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a SimpleConnectionHandle
.
connection | the JDBC Connection to hold |
---|---|
transactionActive | whether the given Connection is involved in an ongoing transaction |
Clear the transactional state of this resource holder.
Create a new JDBC 3.0 Savepoint for the current Connection, using generated savepoint names that are unique for the Connection.
SQLException | if thrown by the JDBC driver |
---|
Return the current Connection held by this ConnectionHolder.
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.
Return the ConnectionHandle held by this ConnectionHolder.
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.
Return whether JDBC 3.0 Savepoints are supported. Caches the flag for the lifetime of this ConnectionHolder.
SQLException | if thrown by the JDBC driver |
---|
Return whether this holder currently has a Connection.
Return whether this holder represents an active, JDBC-managed transaction.
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.
Set whether this holder represents an active, JDBC-managed transaction.