The problem is here:

            ResultQuery query = ctx.resultQuery("select dt from jooqtest
limit 1");

How would you expect jOOQ to know that your dt column inside a plain SQL
string is actually your dateField? It doesn't and it can't. So, the query
is run directly as is against JDBC, and without any type information
available at compile time, the ResultSetMetaData type information is used -
you get a java.sql.Date, and since you switch on that type (the one
retrieved via ResultSetMetaData), you get the behaviour you're observing.

This wouldn't happen, of course, if you had written:

ctx.select(dt).from(table(name("jooqtest"))).limit(1).fetchOne();

There's a feature request for allowing to pass type information to plain
SQL ResultQuery types, but it hasn't been implemented yet:
https://github.com/jOOQ/jOOQ/issues/4473

The other option is the one you've mentioned further down, applying the
converter on the Record that has been fetched without conversion.

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to