PGJDBC now has JSR-310 Support

Version 9.4.1208 of the PostgreSQL JDBC driver (pgjdbc) just shipped. This is the first version to support JSR-310 with JDBC 4.2. The supported JSR-310 data types are:

PostgreSQL™ Java SE 8
DATE LocalDate
TIME [ WITHOUT TIME ZONE ] LocalTime
TIMESTAMP [ WITHOUT TIME ZONE ] LocalDateTime
TIMESTAMP WITH TIME ZONE 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 TIME ZONE ] are not supported. Also note that all OffsetDateTime instances will have be in UTC (have offset 0). This is because the backend stores them as UTC. Besides various data types from tables B-4 and B-5 as well as PGobject subtypes are supported.

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);
    }
}

The PostgreSQL driver documentation should soon be updated to reflect this.

If you’re using Maven the coordinates are:

<dependency>
  <groupId>org.postgresql</groupId>
  <artifactId>postgresql</artifactId>
  <version>9.4.1208</version>
</dependency>