public class DefaultConnectionProvider extends Object implements ConnectionProvider
ConnectionProvider
.
This implementation just wraps a JDBC Connection
and provides jOOQ
with the same connection for every query. jOOQ will not call any
transaction-related methods on the supplied connection. Instead, jOOQ
provides you with convenient access to those methods, wrapping any checked
SQLException
into an unchecked DataAccessException
Constructor and Description |
---|
DefaultConnectionProvider(Connection connection) |
Modifier and Type | Method and Description |
---|---|
Connection |
acquire()
Acquire a connection from the connection lifecycle handler.
|
void |
commit()
Convenience method to access
Connection.commit() . |
protected void |
finalize() |
boolean |
getAutoCommit()
Convenience method to access
Connection.getAutoCommit() . |
int |
getHoldability()
Convenience method to access
Connection.getHoldability() . |
int |
getTransactionIsolation()
Convenience method to access
Connection.getTransactionIsolation() . |
void |
release(Connection released)
Release a connection to the connection lifecycle handler.
|
void |
releaseSavepoint(Savepoint savepoint)
Convenience method to access
Connection.releaseSavepoint(Savepoint) . |
void |
rollback()
Convenience method to access
Connection.rollback() . |
void |
rollback(Savepoint savepoint)
Convenience method to access
Connection.rollback(Savepoint) . |
void |
setAutoCommit(boolean autoCommit)
Convenience method to access
Connection.setAutoCommit(boolean) . |
void |
setConnection(Connection connection) |
void |
setHoldability(int holdability)
Convenience method to access
Connection.setHoldability(int) . |
Savepoint |
setSavepoint()
Convenience method to access
Connection.setSavepoint() . |
Savepoint |
setSavepoint(String name)
Convenience method to access
Connection.setSavepoint(String) . |
void |
setTransactionIsolation(int level)
Convenience method to access
Connection.setTransactionIsolation(int) . |
public DefaultConnectionProvider(Connection connection)
public final Connection acquire()
ConnectionProvider
This method is called by jOOQ exactly once per execution lifecycle, i.e.
per ExecuteContext
. Implementations may freely chose, whether
subsequent calls to this method:
javax.transaction.UserTransaction
)
jOOQ will guarantee that every acquired connection is released through
ConnectionProvider.release(Connection)
exactly once.
acquire
in interface ConnectionProvider
ExecuteContext
.public final void release(Connection released)
ConnectionProvider
jOOQ will guarantee that every acquired connection is released exactly once.
release
in interface ConnectionProvider
released
- A connection that was previously obtained from
ConnectionProvider.acquire()
. This is never null
.protected void finalize() throws Throwable
public final void setConnection(Connection connection)
public final void commit() throws DataAccessException
Connection.commit()
.DataAccessException
public final void rollback() throws DataAccessException
Connection.rollback()
.DataAccessException
public final void rollback(Savepoint savepoint) throws DataAccessException
Connection.rollback(Savepoint)
.DataAccessException
public final Savepoint setSavepoint() throws DataAccessException
Connection.setSavepoint()
.DataAccessException
public final Savepoint setSavepoint(String name) throws DataAccessException
Connection.setSavepoint(String)
.DataAccessException
public final void releaseSavepoint(Savepoint savepoint) throws DataAccessException
Connection.releaseSavepoint(Savepoint)
.DataAccessException
public final void setAutoCommit(boolean autoCommit) throws DataAccessException
Connection.setAutoCommit(boolean)
.DataAccessException
public final boolean getAutoCommit() throws DataAccessException
Connection.getAutoCommit()
.DataAccessException
public final void setHoldability(int holdability) throws DataAccessException
Connection.setHoldability(int)
.DataAccessException
public final int getHoldability() throws DataAccessException
Connection.getHoldability()
.DataAccessException
public final void setTransactionIsolation(int level) throws DataAccessException
Connection.setTransactionIsolation(int)
.DataAccessException
public final int getTransactionIsolation() throws DataAccessException
Connection.getTransactionIsolation()
.DataAccessException
Copyright © 2015. All Rights Reserved.