HHH-10371 - LocalDate value changes after fetching the row from the database
This commit is contained in:
parent
55ce22a740
commit
0e7dfa1935
|
@ -111,11 +111,15 @@ public class LocalDateJavaDescriptor extends AbstractTypeDescriptor<LocalDate> {
|
|||
}
|
||||
|
||||
if ( Date.class.isInstance( value ) ) {
|
||||
final Date ts = (Date) value;
|
||||
final Instant instant = Instant.ofEpochMilli( ts.getTime() );
|
||||
return LocalDateTime.ofInstant( instant, ZoneId.systemDefault() ).toLocalDate();
|
||||
if ( java.sql.Date.class.isInstance( value ) ) {
|
||||
return ((java.sql.Date) value).toLocalDate();
|
||||
}
|
||||
else {
|
||||
return Instant.ofEpochMilli( ((Date) value).getTime() ).atZone( ZoneId.systemDefault() ).toLocalDate();
|
||||
}
|
||||
}
|
||||
|
||||
throw unknownWrap( value.getClass() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue