All versions: 3.11 | 3.10 | 3.9 | Development versions: 3.12

With jOOQ 3.9, support for JSR-310 java.time types has been added to the jOOQ API and to the code generator. Users of Java 8 can now specify that the jOOQ code generator should prefer JSR 310 types over their equivalent JDBC types. This includes:

Semantically, the above types are exactly equivalent, although the new types do away with the many flaws of the JDBC types. If there is no JDBC type for an equivalent JSR 310 type, then the JSR 310 type is generated by default. This includes

To get more fine-grained control of the above, you may wish to consider applying data type rewriting.

In order to activate the generation of these types, use:

XML configuration (standalone and Maven)

<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.11.0.xsd">
  <generator>
    <generate>
      <javaTimeTypes>true</javaTimeTypes>
    </generate>
  </generator>
</configuration>

Programmatic configuration

configuration
  .withGenerator(new Generator(
    .withGenerate(new Generate()
      .withJavaTimeTypes(true))));

Gradle configuration

myConfigurationName(sourceSets.main) {
  generator {
    generate {
      javaTimeTypes = true
    }
  }
}
The jOOQ Logo