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 ) ) {
|
if ( Date.class.isInstance( value ) ) {
|
||||||
final Date ts = (Date) value;
|
if ( java.sql.Date.class.isInstance( value ) ) {
|
||||||
final Instant instant = Instant.ofEpochMilli( ts.getTime() );
|
return ((java.sql.Date) value).toLocalDate();
|
||||||
return LocalDateTime.ofInstant( instant, ZoneId.systemDefault() ).toLocalDate();
|
}
|
||||||
|
else {
|
||||||
|
return Instant.ofEpochMilli( ((Date) value).getTime() ).atZone( ZoneId.systemDefault() ).toLocalDate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw unknownWrap( value.getClass() );
|
throw unknownWrap( value.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue