- All Implemented Interfaces:
public class DataSourceConnectionProvider extends Object implements ConnectionProviderA default implementation for a pooled
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, such as
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
close()invocation (e.g. a transaction rollback). Use a
DefaultConnectionProviderinstead, to control the connection's lifecycle, or implement your own
- Aaron Digulla, Lukas Eder
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
acquire()Acquire a connection from the connection lifecycle handler.
release(Connection connection)Release a connection to the connection lifecycle handler.
public DataSourceConnectionProvider(DataSource dataSource)
@NotNull public @NotNull DataSource dataSource()
@NotNull public @NotNull Connection acquire()Description copied from interface:
ConnectionProviderAcquire 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
- return a fresh connection instance every time
jOOQ will guarantee that every acquired connection is released through
public void release(Connection connection)Description copied from interface:
ConnectionProviderRelease a connection to the connection lifecycle handler.
jOOQ will guarantee that every acquired connection is released exactly once.