Module org.jooq
Package org.jooq

Interface Unwrapper


public interface Unwrapper
An unwrapper SPI that can be used to override the default unwrapping algorithm.

In some cases, jOOQ needs to get access to the native JDBC driver APIs in order to call vendor specific methods, such as Oracle's OracleConnection.createARRAY(). jOOQ doesn't expect clients to provide a native JDBC Connection through the ConnectionProvider SPI. Implementations may well provide jOOQ with some proxy that implements things like logging, thread-bound transactionality, connection pooling, etc.

In order to access the native API, Wrapper.unwrap(Class) needs to be called, or in some cases, when third party libraries do not properly implement this contract, some specific methods are called reflectively, including:

  • org.springframework.jdbc.datasource.ConnectionProxy#getTargetConnection()
  • org.apache.commons.dbcp.DelegatingConnection#getDelegate()
  • org.jboss.jca.adapters.jdbc.WrappedConnection#getUnderlyingConnection()
  • ...

Not all such third party libraries are "known" to jOOQ, so clients can implement their own unwrapper to support theirs.

Author:
Lukas Eder
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    unwrap​(Wrapper wrapper, Class<T> iface)
    Unwrap a wrapped type from a JDBC Wrapper.
  • Method Details

    • unwrap

      <T> T unwrap(Wrapper wrapper, Class<T> iface)
      Unwrap a wrapped type from a JDBC Wrapper.