static Statement newInstance(Statement stmt, ConnectionInvocationHandler connectionHandler) {

            Class<?> o = stmt.getClass();
            List<Class<?>> interfaces = new ArrayList<>();
            while (!o.equals(Object.class)) {
                interfaces.addAll(Arrays.asList(o.getInterfaces()));
                o = o.getSuperclass();
            }

            return (Statement) Proxy.newProxyInstance(stmt.getClass().getClassLoader(),
                interfaces.toArray(new Class[0]),
                new StatementInvocationHandler(stmt, connectionHandler));
        }
Oracle was getting angry about too many open cursors because of the large number of prepared statements being created and cached indefinitely.
core/src/test/java/org/jdbi/v3/core/TestTooManyCursors.java