diff --git a/hibernate-java8/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaDescriptor.java b/hibernate-java8/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaDescriptor.java index 08d0f2b379..d911e0fb04 100644 --- a/hibernate-java8/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaDescriptor.java +++ b/hibernate-java8/src/main/java/org/hibernate/type/descriptor/java/LocalDateJavaDescriptor.java @@ -111,11 +111,15 @@ public class LocalDateJavaDescriptor extends AbstractTypeDescriptor { } 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() ); } + }