Connection.
DataSourceTransactionManager binds instances of this class
to the thread, for a specific javax.sql.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
| Modifier and Type | Field and Description |
|---|---|
| private ConnectionHandle | |
| private Connection | |
| public static final String | SAVEPOINT_NAME_PREFIX
Prefix for savepoint names. |
| private int | |
| private Boolean | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | ConnectionHolder(ConnectionHandle
the ConnectionHandle to hold connectionHandle)Create a new ConnectionHolder for the given ConnectionHandle. |
| public | ConnectionHolder(Connection
the JDBC Connection to hold connection)Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a |
| public | ConnectionHolder(Connection
the JDBC Connection to hold connection, boolean whether the given Connection is involved
in an ongoing transaction transactionActive)Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a |
| Modifier and Type | Method and Description |
|---|---|
| public void | clear()
Overrides org. |
| public Savepoint | Returns: the new SavepointCreate a new JDBC Savepoint for the current Connection, using generated savepoint names that are unique for the Connection. |
| public Connection | |
| public ConnectionHandle | |
| protected boolean | |
| protected boolean | |
| public void | released()
Overrides org. |
| 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 |
| connectionHandle | back to summary |
|---|---|
| private ConnectionHandle connectionHandle
| |
| currentConnection | back to summary |
|---|---|
| private Connection currentConnection
| |
| SAVEPOINT_NAME_PREFIX | back to summary |
|---|---|
| public static final String SAVEPOINT_NAME_PREFIX Prefix for savepoint names. | |
| savepointCounter | back to summary |
|---|---|
| private int savepointCounter | |
| savepointsSupported | back to summary |
|---|---|
| private Boolean savepointsSupported
| |
| transactionActive | back to summary |
|---|---|
| private boolean transactionActive | |
| ConnectionHolder | back to summary |
|---|---|
| public ConnectionHolder(ConnectionHandle connectionHandle) Create a new ConnectionHolder for the given ConnectionHandle.
| |
| ConnectionHolder | back to summary |
|---|---|
| public ConnectionHolder(Connection connection) Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a
| |
| ConnectionHolder | back to summary |
|---|---|
| public ConnectionHolder(Connection connection, boolean transactionActive) Create a new ConnectionHolder for the given JDBC Connection,
wrapping it with a
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org. Doc from org. Clear the transactional state of this resource holder.
| |
| createSavepoint | back to summary |
|---|---|
| public Savepoint createSavepoint() throws SQLException Create a new JDBC Savepoint for the current Connection, using generated savepoint names that are unique for the Connection.
| |
| getConnection | back to summary |
|---|---|
| public Connection getConnection() Return the current Connection held by this ConnectionHolder. This will be the same Connection until
| |
| getConnectionHandle | back to summary |
|---|---|
| public ConnectionHandle getConnectionHandle() Return the ConnectionHandle held by this ConnectionHolder.
| |
| hasConnection | back to summary |
|---|---|
| protected boolean hasConnection() Return whether this holder currently has a Connection. | |
| isTransactionActive | back to summary |
|---|---|
| protected boolean isTransactionActive() Return whether this holder represents an active, JDBC-managed transaction. | |
| released | back to summary |
|---|---|
| public void released() Overrides org. 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.
| |
| setConnection | back to summary |
|---|---|
| protected void setConnection(Connection connection) Override the existing Connection handle with the given Connection.
Reset the handle if given Used for releasing the Connection on suspend (with a | |
| setTransactionActive | back to summary |
|---|---|
| protected void setTransactionActive(boolean transactionActive) Set whether this holder represents an active, JDBC-managed transaction.
| |
| supportsSavepoints | back to summary |
|---|---|
| public boolean supportsSavepoints() throws SQLException Return whether JDBC Savepoints are supported. Caches the flag for the lifetime of this ConnectionHolder.
| |