I want to store a LocalDate
in a DATE
column and retrieve it unchanged. Both DATE
and LocalDate
are \"local\" types by de
I just tried the following modification to your retrieve
method and it worked for me:
The H2 documentation for the DATE Type says that it is
The date data type. The format is yyyy-MM-dd.
So, instead of your ...
java.sql.Date retrieved = (java.sql.Date) rs.getObject("born");
return retrieved.toLocalDate();
... I just used ...
return LocalDate.parse(rs.getString("born"));
... and my code produced
Inserted: 2015-05-20
Retrieved: 2015-05-20
Retrieved: 2015-05-20
Retrieved: 2015-05-20