public class DefaultConnectionProvider extends java.lang.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(java.sql.Connection connection) |
Modifier and Type | Method and Description |
---|---|
java.sql.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() . |
boolean |
isReadOnly()
Convenience method to access
Connection.isReadOnly() . |
void |
release(java.sql.Connection released)
Release a connection to the connection lifecycle handler.
|
void |
releaseSavepoint(java.sql.Savepoint savepoint)
Convenience method to access
Connection.releaseSavepoint(Savepoint) . |
void |
rollback()
Convenience method to access
Connection.rollback() . |
void |
rollback(java.sql.Savepoint savepoint)
Convenience method to access
Connection.rollback(Savepoint) . |
void |
setAutoCommit(boolean autoCommit)
Convenience method to access
Connection.setAutoCommit(boolean) . |
void |
setConnection(java.sql.Connection connection) |
void |
setHoldability(int holdability)
Convenience method to access
Connection.setHoldability(int) . |
void |
setReadOnly(boolean readOnly)
Convenience method to access
Connection.setReadOnly(boolean) . |
java.sql.Savepoint |
setSavepoint()
Convenience method to access
Connection.setSavepoint() . |
java.sql.Savepoint |
setSavepoint(java.lang.String name)
Convenience method to access
Connection.setSavepoint(String) . |
void |
setTransactionIsolation(int level)
Convenience method to access
Connection.setTransactionIsolation(int) . |
public DefaultConnectionProvider(java.sql.Connection connection)
public final java.sql.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(java.sql.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 java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public final void setConnection(java.sql.Connection connection)
public final void commit() throws DataAccessException
Connection.commit()
.DataAccessException
public final void rollback() throws DataAccessException
Connection.rollback()
.DataAccessException
public final void rollback(java.sql.Savepoint savepoint) throws DataAccessException
Connection.rollback(Savepoint)
.DataAccessException
public final java.sql.Savepoint setSavepoint() throws DataAccessException
Connection.setSavepoint()
.DataAccessException
public final java.sql.Savepoint setSavepoint(java.lang.String name) throws DataAccessException
Connection.setSavepoint(String)
.DataAccessException
public final void releaseSavepoint(java.sql.Savepoint savepoint) throws DataAccessException
Connection.releaseSavepoint(Savepoint)
.DataAccessException
public final void setReadOnly(boolean readOnly) throws DataAccessException
Connection.setReadOnly(boolean)
.DataAccessException
public final boolean isReadOnly() throws DataAccessException
Connection.isReadOnly()
.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 © 2018. All Rights Reserved.