HHH-12586 Strange date type confusion in JdbcDateTypeDescriptor

https://hibernate.atlassian.net/browse/HHH-12586
This commit is contained in:
Philippe Marschall 2018-05-18 18:00:34 +02:00 committed by Chris Cranford
parent 21bd9a6a9f
commit 37467554e7
3 changed files with 5 additions and 5 deletions

View File

@ -127,7 +127,7 @@ public class JdbcDateTypeDescriptor extends AbstractTypeDescriptor<Date> {
if ( value == null ) {
return null;
}
if ( Date.class.isInstance( value ) ) {
if ( java.sql.Date.class.isInstance( value ) ) {
return (Date) value;
}
@ -139,8 +139,8 @@ public class JdbcDateTypeDescriptor extends AbstractTypeDescriptor<Date> {
return new java.sql.Date( ( (Calendar) value ).getTimeInMillis() );
}
if ( java.util.Date.class.isInstance( value ) ) {
return new java.sql.Date( ( (java.util.Date) value ).getTime() );
if ( Date.class.isInstance( value ) ) {
return new java.sql.Date( ( (Date) value ).getTime() );
}
throw unknownWrap( value.getClass() );

View File

@ -143,7 +143,7 @@ public class JdbcTimeTypeDescriptor extends AbstractTypeDescriptor<Date> {
}
if ( Date.class.isInstance( value ) ) {
return (Date) value;
return new Time( ( (Date) value ).getTime() );
}
throw unknownWrap( value.getClass() );

View File

@ -152,7 +152,7 @@ public class JdbcTimestampTypeDescriptor extends AbstractTypeDescriptor<Date> {
}
if ( Date.class.isInstance( value ) ) {
return (Date) value;
return new Timestamp( ( (Date) value ).getTime() );
}
throw unknownWrap( value.getClass() );