From bc6bc1479c4594adb101810912d6fee469682d11 Mon Sep 17 00:00:00 2001 From: lukaseder Date: Wed, 2 Jan 2019 12:22:14 +0100 Subject: [PATCH] [#8145] Add an UnwrapProvider SPI that allows for unwrapping underlying JDBC types through proprietary APIs --- .../resources/org/jooq/web/manual-3.12.xml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml index 5b4f8499ac..73508b29da 100644 --- a/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml +++ b/jOOQ-manual/src/main/resources/org/jooq/web/manual-3.12.xml @@ -3314,6 +3314,48 @@ configuration.set( +
+ Custom Unwrappers + +

+ JDBC knows the API, which is implemented by all JDBC types in order to be able to "unwrap" a native driver implementation for any given type. For example: +

+ + + +

+ jOOQ internally makes similar calls occasionally. For this, it needs to unwrap the native or instance. Unfortunately, not all third party libraries correctly implement the Wrapper API contract, so this unwrapping might not work. The SPI is designed to allow for custom implementations to be injected into jOOQ configurations: +

+ + T unwrap(Wrapper wrapper, Class iface) { + try { + if (wrapper instanceof Connection) + // ... + else if (wrapper instanceof Statement) + // ... + else + wrapper.unwrap(iface); + } + catch (SQLException e) { + // ... + } + } +}); + +// Work with the derived configuration, where needed +DSL.using(c2).fetch("...");]]> +
+
+
Custom Settings