H2 now has JSR-310 Support

Version 1.4.193 of H2 database shipped some weeks ago. This is the first version to support JSR-310 with JDBC 4.2. The supported JSR-310 data types are:

H2 Java SE 8
DATE LocalDate
TIME [ WITHOUT TIMEZONE ] LocalTime
TIMESTAMP [ WITHOUT TIMEZONE ] LocalDateTime
TIMESTAMP WITH TIMEZONE OffsetTime

This is closely aligned with tables B-4 and B-5 of the JDBC 4.2 specification. Note that ZonedDateTime, Instant and OffsetTime / TIME [ WITHOUT TIMEZONE ] are not supported. The syntax does not follow the SQL standard. LocalTime also has nanosecond resolution.

You can use the API like this:

try (Statement st = conn.createStatement();  
    ResultSet rs = st.executeQuery("SELECT * FROM mytable WHERE columnfoo = 500")) {
    while (rs.next()) {
        LocalDate localDate = rs.getObject(1, LocalDate.class);
        System.out.println(localDate);
    }
}

If you’re using Maven the coordinates are:

<dependency>
  <groupId>com.h2database</groupId>
  <artifactId>h2</artifactId>
  <version>1.4.193</version>
</dependency>

Due to a bug fixed in 1.4.194 (not yet released) you also need

 <dependency>
  <groupId>com.vividsolutions</groupId>
  <artifactId>jts-core</artifactId>
  <version>1.14.0</version>
</dependency>