HHH-10371 - LocalDate value changes after fetching the row from the database
This commit is contained in:
parent
501f1948a2
commit
7f1bf8f3f7
|
@ -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