HHH-12586 Strange date type confusion in JdbcDateTypeDescriptor
https://hibernate.atlassian.net/browse/HHH-12586
This commit is contained in:
parent
21bd9a6a9f
commit
37467554e7
|
@ -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() );
|
||||
|
|
|
@ -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() );
|
||||
|
|
|
@ -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() );
|
||||
|
|
Loading…
Reference in New Issue