Any advantage in using LocalDateTime binding

45 views
Skip to first unread message

Silvio

unread,
Jan 21, 2020, 8:13:27 AM1/21/20
to H2 Database
H2 supports preparedStatement.setObject(n,localDateTimeValue) and resultSet.getObject(n,LocalDateTime.class). I would like to know if there is any performance advantage to be gained by using this (i.e. H2 using java.time internally instead of Date/Calendar) or is it a simple wrapper around the same internal date handling functions?

Evgenij Ryazanov

unread,
Jan 21, 2020, 8:46:43 AM1/21/20
to H2 Database
Hello.

No, they don't use any wrappers in latest versions of H2, they all are handled by own implementations in H2.

Actually legacy java.util.* and java.sql.* data types have different bugs in Java; don't use them if you can.

Documentation of H2 also recommends JSR-310 data types:
java.time.LocalDateTime is also supported and recommended on Java 8 and later versions.

Silvio

unread,
Jan 21, 2020, 5:40:55 PM1/21/20
to H2 Database
Thanks for confirming that. Internally our application uses java.time almost exclusively but is converted where 3rd party APIs require so. The JDBC binding for timestamp is currently one of these cases.
Reply all
Reply to author
Forward
0 new messages