Hi Lukas,
in plain JDBC one can set date like this "{d '2014-05-25'}" or get date
like "2014-05-25" and parse it.This way there is no need to deal with tragic sql.Date objects. When declaring a jOOQ converter for date field, we can pick any user object we want, like LocalDate, but we are forced to use sql.Date as database type. Declaring String will not work, the code generator will produce broken definition. Regards, Witold Szczerba --- Sent from my mobile phone. On May 25, 2014 10:08 AM, "Lukas Eder" <[email protected]> wrote: > Hi Łukasz, > > I wasn't aware of such a "limitation" of the java.sql.Date type. How would > you do it with JDBC, when binding java.sql.Date? Probably, using an > additional Calendar object, through: > > http://docs.oracle.com/javase/7/docs/api/java/sql/PreparedStatement.html#setDate(int,%20java.sql.Date > ,%20java.util.Calendar) > > I suspect there might currently be a flaw in how jOOQ handles DATE and > TIMESTAMP columns with respect to timezones...? > > As a workaround, you could inline such date columns using DSL.inline(): > http://www.jooq.org/javadoc/3.3.x/org/jooq/impl/DSL.html#inline(T) > > That will make jOOQ render something like DATE '2014-05-25'. > > Another option is to resort to plain SQL or custom QueryParts: > - http://www.jooq.org/doc/latest/manual/sql-building/plain-sql/ > - > http://www.jooq.org/doc/latest/manual/sql-building/queryparts/custom-queryparts/ > > > 2014-05-23 15:01 GMT+02:00 Łukasz Stachowiak <[email protected]>: > >> Hi, >> >> I'm using postgres database and I want to insert value into 'Date' type >> column - which is without timezone. >> Problem is that JOOQ internally uses java.sql.Date which extends >> java.util.Date - date with timezone. >> Is there any way to do it? >> >> >> Regards, >> Łukasz >> >> -- >> 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. >> > > -- > 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. > -- 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.
