Top Description Fields Constructors Methods
org.jooq.impl

public Class DefaultConnectionProvider

extends Object
implements ConnectionProvider
Class Inheritance
All Implemented Interfaces
org.jooq.ConnectionProvider
Known Direct Subclasses
org.jooq.impl.DefaultCloseableConnectionProvider
Imports
java.sql.Connection, .SQLException, .Savepoint, org.jooq.ConnectionProvider, org.jooq.exception.DataAccessException, org.jooq.tools.JooqLogger, org.jetbrains.annotations.NotNull

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

Authors
Aaron Digulla, Lukas Eder

Field Summary

Modifier and TypeField and Description
pack-priv Connection
private static final JooqLogger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final @NotNull Connection
acquire()

Implements org.jooq.ConnectionProvider.acquire.

Acquire a connection from the connection lifecycle handler.
public final void
commit()

Convenience method to access Connection#commit().

public final boolean
getAutoCommit()

Convenience method to access Connection#getAutoCommit().

public final int
getHoldability()

Convenience method to access Connection#getHoldability().

public final int
public final boolean
isReadOnly()

Convenience method to access Connection#isReadOnly().

public final void
release(Connection
A connection that was previously obtained from acquire(). This is never null.
released
)

Implements org.jooq.ConnectionProvider.release.

Release a connection to the connection lifecycle handler.
public final void
releaseSavepoint(Savepoint savepoint)

Convenience method to access Connection#releaseSavepoint(Savepoint).

public final void
rollback()

Convenience method to access Connection#rollback().

public final void
rollback(Savepoint savepoint)

Convenience method to access Connection#rollback(Savepoint).

public final void
setAutoCommit(boolean autoCommit)

Convenience method to access Connection#setAutoCommit(boolean).

public final void
public final void
setHoldability(int holdability)

Convenience method to access Connection#setHoldability(int).

public final void
setReadOnly(boolean readOnly)

Convenience method to access Connection#setReadOnly(boolean).

public final @NotNull Savepoint
setSavepoint()

Convenience method to access Connection#setSavepoint().

public final @NotNull Savepoint
setSavepoint(String name)

Convenience method to access Connection#setSavepoint(String).

public final void
setTransactionIsolation(int level)

Convenience method to access Connection#setTransactionIsolation(int).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

connectionback to summary
pack-priv Connection connection
logback to summary
private static final JooqLogger log

Constructor Detail

DefaultConnectionProviderback to summary
public DefaultConnectionProvider(Connection connection)

Method Detail

acquireback to summary
public final @NotNull Connection acquire()

Implements org.jooq.ConnectionProvider.acquire.

Doc from org.jooq.ConnectionProvider.acquire.

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 release(Connection) exactly once.

Returns:@NotNull Connection

A connection for the current ExecuteContext. If null is returned (e.g. by NoConnectionProvider), then statements cannot be executed. Attempts to execute statements will result in a DetachedException.

Annotations
@NotNull
@Override
commitback to summary
public final void commit() throws DataAccessException

Convenience method to access Connection#commit().

getAutoCommitback to summary
public final boolean getAutoCommit() throws DataAccessException

Convenience method to access Connection#getAutoCommit().

getHoldabilityback to summary
public final int getHoldability() throws DataAccessException

Convenience method to access Connection#getHoldability().

getTransactionIsolationback to summary
public final int getTransactionIsolation() throws DataAccessException

Convenience method to access Connection#getTransactionIsolation().

isReadOnlyback to summary
public final boolean isReadOnly() throws DataAccessException

Convenience method to access Connection#isReadOnly().

releaseback to summary
public final void release(Connection released)

Implements org.jooq.ConnectionProvider.release.

Doc from org.jooq.ConnectionProvider.release.

Release a connection to the connection lifecycle handler.

jOOQ will guarantee that every acquired connection is released exactly once.

Parameters
released:Connection

A connection that was previously obtained from acquire(). This is never null.

Annotations
@Override
releaseSavepointback to summary
public final void releaseSavepoint(Savepoint savepoint) throws DataAccessException

Convenience method to access Connection#releaseSavepoint(Savepoint).

rollbackback to summary
public final void rollback() throws DataAccessException

Convenience method to access Connection#rollback().

rollbackback to summary
public final void rollback(Savepoint savepoint) throws DataAccessException

Convenience method to access Connection#rollback(Savepoint).

setAutoCommitback to summary
public final void setAutoCommit(boolean autoCommit) throws DataAccessException

Convenience method to access Connection#setAutoCommit(boolean).

setConnectionback to summary
public final void setConnection(Connection connection)
setHoldabilityback to summary
public final void setHoldability(int holdability) throws DataAccessException

Convenience method to access Connection#setHoldability(int).

setReadOnlyback to summary
public final void setReadOnly(boolean readOnly) throws DataAccessException

Convenience method to access Connection#setReadOnly(boolean).

setSavepointback to summary
public final @NotNull Savepoint setSavepoint() throws DataAccessException

Convenience method to access Connection#setSavepoint().

Annotations
@NotNull
setSavepointback to summary
public final @NotNull Savepoint setSavepoint(String name) throws DataAccessException

Convenience method to access Connection#setSavepoint(String).

Annotations
@NotNull
setTransactionIsolationback to summary
public final void setTransactionIsolation(int level) throws DataAccessException

Convenience method to access Connection#setTransactionIsolation(int).