Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add <javaTimeTypes/> to code generator configuration to generate Java 8 java.time types instead of java.sql types #4429

Closed
lukaseder opened this issue Jul 27, 2015 · 11 comments

Comments

Projects
None yet
6 participants
@lukaseder
Copy link
Member

commented Jul 27, 2015

The new Java 8 API (see #3645) should support generating java.time types by default, rather than the insufficient java.sql types. This is useful when supporting { TIME | TIMESTAMP } WITH TIME ZONE types.

The JDBC spec (http://download.oracle.com/otndocs/jcp/jdbc-4_2-mrel2-eval-spec/index.html) specifies:

  • Added support to map java.time.LocalDate to JDBC DATE.
  • Added support to map java.time.LocalTime to JDBC TIME
  • Added support to map java.time.LocalDateTime to JDBC TIMESTAMP.
  • Added support to map java.time.OffsetTime to JDBC TIME_WITH_TIMEZONE.
  • Added support to map java.time.OffsetDateTime to JDBC TIMESTAMP_WITH_TIMEZONE.

@lukaseder lukaseder added this to the Version 3.7.0 milestone Jul 27, 2015

lukaseder added a commit that referenced this issue Jul 27, 2015

[#4429] Add <javaTimeTypes/> to code generator configuration to gener…
…ate Java 8 java.time types instead of java.sql types (incomplete implementation)

lukaseder added a commit that referenced this issue Jul 29, 2015

@yzmyyff

This comment has been minimized.

Copy link

commented Sep 10, 2015

When will you release v3.7?
I really want to change the time type.

And, could it be easily implement on v 3.6.x?

Thanks a lot for your works.

@ooxi

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2015

You can always use Converter for custom java.time types

@lukaseder

This comment has been minimized.

Copy link
Member Author

commented Sep 11, 2015

3.7 is due for the end of September

@lukaseder

This comment has been minimized.

Copy link
Member Author

commented Oct 6, 2015

We won't be able to add support for JSR-310 in jOOQ 3.7's code generator. There are still too many open questions. Only the runtime will be capable of handling these data types.

@lightoze

This comment has been minimized.

Copy link

commented Apr 15, 2016

When implementing date-time handling functions for Java 8, please also keep in mind possibility to use other types such as Instant and Duration (for intervals).

@lukaseder

This comment has been minimized.

Copy link
Member Author

commented Apr 15, 2016

Yes, indeed. Duration corresponds to SQL's INTERVAL DAY TO SECOND, whereas YearMonth corresponds to SQL's INTERVAL YEAR TO MONTH

@eiswind

This comment has been minimized.

Copy link

commented Sep 24, 2016

Is there any progress on this one or do I still need to use custom types?

@lukaseder

This comment has been minimized.

Copy link
Member Author

commented Oct 3, 2016

@eiswind: Unfortunately, no progress yet. Chances are, that jOOQ 3.9 will be delayed a bit to get this in, though. It's really a priority to finally support JSR 310 in jOOQ

@lukaseder

This comment has been minimized.

Copy link
Member Author

commented Dec 20, 2016

This is now implemented as an opt-in flag. With more end user experience, we'll eventually switch the flag's default value to true (#5714)

@lukaseder lukaseder closed this Dec 20, 2016

lukaseder added a commit that referenced this issue Dec 20, 2016

[#4429] Add <javaTimeTypes/> to code generator configuration to gener…
…ate Java 8 java.time types instead of java.sql types
@stupidSheep

This comment has been minimized.

Copy link

commented Dec 29, 2016

Hi @lukaseder I just wanted to thank you for implementing this feature! I started migrating to jooq a few weeks back and was eagerly looking forward to java.time API support :-)
Many thanks (and apologies for the off-topic comment)!

@lukaseder

This comment has been minimized.

Copy link
Member Author

commented Dec 29, 2016

Hey, you're welcome, "@stupidSheep" :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.