The ConnectionProvider allows for abstracting the handling of
custom Connection lifecycles outside of jOOQ, injecting
behaviour into jOOQ's internals. jOOQ will try to acquire a new JDBC
Connection from the connection provider as early as needed, and will
release it as early as possible.
TransactionProvider implementations may choose to influence
ConnectionProvider behaviour, e.g. by acquiring connections upon
TransactionProvider#begin(TransactionContext) and by releasing
connections only upon TransactionProvider#commit(TransactionContext),
or TransactionProvider#rollback(TransactionContext).
| Modifier and Type | Method and Description |
|---|---|
| public @Nullable Connection | Returns: A connection for the currentExecuteContext. If
null is returned (e.g. by NoConnectionProvider),
then statements cannot be executed. Attempts to execute
statements will result in a DetachedException.Acquire a connection from the connection lifecycle handler. |
| public void | release(Connection
A connection that was previously obtained from
connection)acquire(). This is never null.Release a connection to the connection lifecycle handler. |
| acquire | back to summary |
|---|---|
| public @Nullable Connection acquire() throws DataAccessException Acquire a connection from the connection lifecycle handler.
This method is called by jOOQ exactly once per execution lifecycle, i.e.
per
jOOQ will guarantee that every acquired connection is released through
| |
| release | back to summary |
|---|---|
| public void release(Connection connection) throws DataAccessException Release a connection to the connection lifecycle handler. jOOQ will guarantee that every acquired connection is released exactly once.
| |