java.lang.Object
org.jooq.impl.DefaultConnectionProvider
- All Implemented Interfaces:
ConnectionProvider
A default implementation for
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
- Author:
- Aaron Digulla, Lukas Eder
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal @NotNull Connection
acquire()
Acquire a connection from the connection lifecycle handler.final void
commit()
Convenience method to accessConnection.commit()
.final boolean
Convenience method to accessConnection.getAutoCommit()
.final int
Convenience method to accessConnection.getHoldability()
.final int
Convenience method to accessConnection.getTransactionIsolation()
.final boolean
Convenience method to accessConnection.isReadOnly()
.final void
release
(Connection released) Release a connection to the connection lifecycle handler.final void
releaseSavepoint
(Savepoint savepoint) Convenience method to accessConnection.releaseSavepoint(Savepoint)
.final void
rollback()
Convenience method to accessConnection.rollback()
.final void
Convenience method to accessConnection.rollback(Savepoint)
.final void
setAutoCommit
(boolean autoCommit) Convenience method to accessConnection.setAutoCommit(boolean)
.final void
setConnection
(Connection connection) final void
setHoldability
(int holdability) Convenience method to accessConnection.setHoldability(int)
.final void
setReadOnly
(boolean readOnly) Convenience method to accessConnection.setReadOnly(boolean)
.final @NotNull Savepoint
Convenience method to accessConnection.setSavepoint()
.final @NotNull Savepoint
setSavepoint
(String name) Convenience method to accessConnection.setSavepoint(String)
.final void
setTransactionIsolation
(int level) Convenience method to accessConnection.setTransactionIsolation(int)
.
-
Constructor Details
-
DefaultConnectionProvider
-
-
Method Details
-
acquire
Description copied from interface:ConnectionProvider
Acquire a connection from the connection lifecycle handler.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:- return the same connection instance
- return the same connection instance for the same thread
- return the same connection instance for the same transaction (e.g. a
javax.transaction.UserTransaction
) - return a fresh connection instance every time
jOOQ will guarantee that every acquired connection is released through
ConnectionProvider.release(Connection)
exactly once.- Specified by:
acquire
in interfaceConnectionProvider
- Returns:
- A connection for the current
ExecuteContext
. Ifnull
is returned (e.g. by NoConnectionProvider), then statements cannot be executed. Attempts to execute statements will result in aDetachedException
.
-
release
Description copied from interface:ConnectionProvider
Release a connection to the connection lifecycle handler.jOOQ will guarantee that every acquired connection is released exactly once.
- Specified by:
release
in interfaceConnectionProvider
- Parameters:
released
- A connection that was previously obtained fromConnectionProvider.acquire()
. This is nevernull
.
-
setConnection
-
commit
Convenience method to accessConnection.commit()
.- Throws:
DataAccessException
-
rollback
Convenience method to accessConnection.rollback()
.- Throws:
DataAccessException
-
rollback
Convenience method to accessConnection.rollback(Savepoint)
.- Throws:
DataAccessException
-
setSavepoint
Convenience method to accessConnection.setSavepoint()
.- Throws:
DataAccessException
-
setSavepoint
Convenience method to accessConnection.setSavepoint(String)
.- Throws:
DataAccessException
-
releaseSavepoint
Convenience method to accessConnection.releaseSavepoint(Savepoint)
.- Throws:
DataAccessException
-
setReadOnly
Convenience method to accessConnection.setReadOnly(boolean)
.- Throws:
DataAccessException
-
isReadOnly
Convenience method to accessConnection.isReadOnly()
.- Throws:
DataAccessException
-
setAutoCommit
Convenience method to accessConnection.setAutoCommit(boolean)
.- Throws:
DataAccessException
-
getAutoCommit
Convenience method to accessConnection.getAutoCommit()
.- Throws:
DataAccessException
-
setHoldability
Convenience method to accessConnection.setHoldability(int)
.- Throws:
DataAccessException
-
getHoldability
Convenience method to accessConnection.getHoldability()
.- Throws:
DataAccessException
-
setTransactionIsolation
Convenience method to accessConnection.setTransactionIsolation(int)
.- Throws:
DataAccessException
-
getTransactionIsolation
Convenience method to accessConnection.getTransactionIsolation()
.- Throws:
DataAccessException
-