- java.lang.Object
- 
- org.jooq.impl.DefaultConnectionProvider
 
- 
- All Implemented Interfaces:
- ConnectionProvider
 
 public class DefaultConnectionProvider extends Object implements ConnectionProvider A default implementation forConnectionProvider.This implementation just wraps a JDBC Connectionand 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 checkedSQLExceptioninto an uncheckedDataAccessException- Author:
- Aaron Digulla, Lukas Eder
 
- 
- 
Constructor SummaryConstructors Constructor Description DefaultConnectionProvider(Connection connection)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Connectionacquire()Acquire a connection from the connection lifecycle handler.voidcommit()Convenience method to accessConnection.commit().protected voidfinalize()booleangetAutoCommit()Convenience method to accessConnection.getAutoCommit().intgetHoldability()Convenience method to accessConnection.getHoldability().intgetTransactionIsolation()Convenience method to accessConnection.getTransactionIsolation().booleanisReadOnly()Convenience method to accessConnection.isReadOnly().voidrelease(Connection released)Release a connection to the connection lifecycle handler.voidreleaseSavepoint(Savepoint savepoint)Convenience method to accessConnection.releaseSavepoint(Savepoint).voidrollback()Convenience method to accessConnection.rollback().voidrollback(Savepoint savepoint)Convenience method to accessConnection.rollback(Savepoint).voidsetAutoCommit(boolean autoCommit)Convenience method to accessConnection.setAutoCommit(boolean).voidsetConnection(Connection connection)voidsetHoldability(int holdability)Convenience method to accessConnection.setHoldability(int).voidsetReadOnly(boolean readOnly)Convenience method to accessConnection.setReadOnly(boolean).SavepointsetSavepoint()Convenience method to accessConnection.setSavepoint().SavepointsetSavepoint(String name)Convenience method to accessConnection.setSavepoint(String).voidsetTransactionIsolation(int level)Convenience method to accessConnection.setTransactionIsolation(int).
 
- 
- 
- 
Constructor Detail- 
DefaultConnectionProviderpublic DefaultConnectionProvider(Connection connection) 
 
- 
 - 
Method Detail- 
acquirepublic final 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
 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:
- acquirein interface- ConnectionProvider
- Returns:
- A connection for the current ExecuteContext.
 
 - 
releasepublic final void release(Connection released) Description copied from interface:ConnectionProviderRelease a connection to the connection lifecycle handler.jOOQ will guarantee that every acquired connection is released exactly once. - Specified by:
- releasein interface- ConnectionProvider
- Parameters:
- released- A connection that was previously obtained from- ConnectionProvider.acquire(). This is never- null.
 
 - 
finalizeprotected void finalize() throws Throwable
 - 
setConnectionpublic final void setConnection(Connection connection) 
 - 
commitpublic final void commit() throws DataAccessExceptionConvenience method to accessConnection.commit().- Throws:
- DataAccessException
 
 - 
rollbackpublic final void rollback() throws DataAccessExceptionConvenience method to accessConnection.rollback().- Throws:
- DataAccessException
 
 - 
rollbackpublic final void rollback(Savepoint savepoint) throws DataAccessException Convenience method to accessConnection.rollback(Savepoint).- Throws:
- DataAccessException
 
 - 
setSavepointpublic final Savepoint setSavepoint() throws DataAccessException Convenience method to accessConnection.setSavepoint().- Throws:
- DataAccessException
 
 - 
setSavepointpublic final Savepoint setSavepoint(String name) throws DataAccessException Convenience method to accessConnection.setSavepoint(String).- Throws:
- DataAccessException
 
 - 
releaseSavepointpublic final void releaseSavepoint(Savepoint savepoint) throws DataAccessException Convenience method to accessConnection.releaseSavepoint(Savepoint).- Throws:
- DataAccessException
 
 - 
setReadOnlypublic final void setReadOnly(boolean readOnly) throws DataAccessExceptionConvenience method to accessConnection.setReadOnly(boolean).- Throws:
- DataAccessException
 
 - 
isReadOnlypublic final boolean isReadOnly() throws DataAccessExceptionConvenience method to accessConnection.isReadOnly().- Throws:
- DataAccessException
 
 - 
setAutoCommitpublic final void setAutoCommit(boolean autoCommit) throws DataAccessExceptionConvenience method to accessConnection.setAutoCommit(boolean).- Throws:
- DataAccessException
 
 - 
getAutoCommitpublic final boolean getAutoCommit() throws DataAccessExceptionConvenience method to accessConnection.getAutoCommit().- Throws:
- DataAccessException
 
 - 
setHoldabilitypublic final void setHoldability(int holdability) throws DataAccessExceptionConvenience method to accessConnection.setHoldability(int).- Throws:
- DataAccessException
 
 - 
getHoldabilitypublic final int getHoldability() throws DataAccessExceptionConvenience method to accessConnection.getHoldability().- Throws:
- DataAccessException
 
 - 
setTransactionIsolationpublic final void setTransactionIsolation(int level) throws DataAccessExceptionConvenience method to accessConnection.setTransactionIsolation(int).- Throws:
- DataAccessException
 
 - 
getTransactionIsolationpublic final int getTransactionIsolation() throws DataAccessExceptionConvenience method to accessConnection.getTransactionIsolation().- Throws:
- DataAccessException
 
 
- 
 
-