Convert Oracle DATE to LocalDateTime with Java Time types

300 views
Skip to first unread message

Dima S

unread,
Aug 10, 2017, 4:13:27 AM8/10/17
to jOOQ User Group
When using javaTimeTypes flag LocalDate is generated for Oracle DATE columns. I wasn't able to find a way to force it to use LocalDateTime (similar to how dateAsTimestamp flag works). Currently, we are not using javaTimeTypes flag and instead are converting from Date to LocalDateTime using custom converter. I tried to keep the converter, but it doesn't work since LocalDate is substituted internally and the time portion is then lost anyway. Is there a way to do it that I missed? It prevents us from switching to new Java Time types in jOOQ.

Thanks,
Dima

Lukas Eder

unread,
Aug 14, 2017, 11:13:38 AM8/14/17
to jooq...@googlegroups.com
Hi Dima,

Thanks for your message. That's interesting - ideally, the two flags should work together, meaning that if you specify javaTimeTypes *and* dateAsTimestamp, you should get LocalDateTime as a data type for DATE columns.

We'll look into this soon, probably a bug. I've registered an issue for this:

In the meantime, do note that dateAsTimestamp is deprecated and will be removed in a future version of jOOQ. The way forward here is to use data type rewriting or converters.

Thanks again for your report,
Lukas

--
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 jooq-user+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dsha...@gmail.com

unread,
Aug 14, 2017, 4:29:28 PM8/14/17
to jOOQ User Group
Hi Lucas, 

Thanks for your response. I was able to make it work by just using ForcedType:
                    forcedType {
                        name = 'timestamp'
                        types = 'DATE'
                    }
What's strange, is that I'm sure that was one of the first things I tried and it didn't work then. Maybe a typo. Anyway, it's not an issue for us anymore. Thanks for your help.

Regards,
Dima
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.

Lukas Eder

unread,
Aug 14, 2017, 4:39:21 PM8/14/17
to jooq...@googlegroups.com
Perfect, thanks for the feedback,
Lukas

To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages