Available in versions: Dev (3.22) | Latest (3.21) | 3.20 | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14

JSR 310 type binding

Supported by ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Historically, JDBC drivers had poor support for the java.time (JSR 310) types, which is why jOOQ encodes some of them in a more compatible way when binding them to JDBC statements. Most modern drivers support these types natively, and binding them natively may perform better both on the client and on the server. The following settings govern this behaviour:

  • bindOffsetDateTimeType: Whether java.time.OffsetDateTime values are bound natively using PreparedStatement.setObject(). The default is false, in case of which jOOQ binds them as formatted strings in many dialects.
  • bindOffsetTimeType: Whether java.time.OffsetTime values are bound natively using PreparedStatement.setObject(). The default is false, in case of which jOOQ binds them as formatted strings in many dialects.
  • bindLocalTimeType: Whether java.time.LocalTime values are bound natively. The default is true. If set to false, jOOQ reverts to the behaviour prior to jOOQ 3.21, binding java.sql.Time values instead, which truncates fractional seconds. Dialects that don't support binding LocalTime natively always use the legacy behaviour.

See also the manual's sections about the OffsetDateTime and OffsetTime data types.

Example configuration

Settings settings = new Settings()
    .withBindOffsetDateTimeType(true) // Defaults to false
    .withBindOffsetTimeType(true)     // Defaults to false
    .withBindLocalTimeType(false);    // Defaults to true

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo