public class DataSourceConnectionProvider extends Object implements ConnectionProvider
This implementation wraps a JDBC
DataSource. jOOQ will use that data
source for initialising connections, and creating statements.
Use this connection provider if you want to run distributed transactions,
javax.transaction.UserTransaction. jOOQ will
close() all connections after query execution (and
result fetching) in order to return the connection to the connection pool. If
you do not use distributed transactions, this will produce driver-specific
behaviour at the end of query execution at
(e.g. a transaction rollback). Use a
instead, to control the connection's lifecycle, or implement your own
|Constructor and Description|
|Modifier and Type||Method and Description|
Acquire a connection from the connection lifecycle handler.
Release a connection to the connection lifecycle handler.
public DataSourceConnectionProvider(DataSource dataSource)
public DataSource dataSource()
public Connection acquire()
This method is called by jOOQ exactly once per execution lifecycle, i.e.
ExecuteContext. Implementations may freely chose, whether
subsequent calls to this method:
jOOQ will guarantee that every acquired connection is released through
ConnectionProvider.release(Connection) exactly once.
public void release(Connection connection)
jOOQ will guarantee that every acquired connection is released exactly once.
Copyright © 2019. All rights reserved.