HHH-16686 - Fix for bug in LocalTimeJavaType.unwrap()

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-05-26 00:49:26 +02:00 committed by Jan Schatteman
parent 21b1c71947
commit 4e9789bdff
3 changed files with 3 additions and 3 deletions

View File

@ -188,7 +188,7 @@ public class JdbcTimeJavaType extends AbstractTemporalJavaType<Date> {
return time;
}
// Preserve milliseconds, which java.sql.Time supports
return new Time( time.getTime() + DateTimeUtils.roundToPrecision( localTime.getNano(), 3 ) );
return new Time( time.getTime() + DateTimeUtils.roundToPrecision( localTime.getNano(), 3 ) / 1000000 );
}
if ( value instanceof Date ) {

View File

@ -88,7 +88,7 @@ public class LocalTimeJavaType extends AbstractTemporalJavaType<LocalTime> {
return (X) time;
}
// Preserve milliseconds, which java.sql.Time supports
return (X) new Time( time.getTime() + DateTimeUtils.roundToPrecision( value.getNano(), 3 ) );
return (X) new Time( time.getTime() + DateTimeUtils.roundToPrecision( value.getNano(), 3 ) / 1000000 );
}
// Oracle documentation says to set the Date to January 1, 1970 when convert from

View File

@ -105,7 +105,7 @@ public class OffsetTimeJavaType extends AbstractTemporalJavaType<OffsetTime> {
return (X) time;
}
// Preserve milliseconds, which java.sql.Time supports
return (X) new Time( time.getTime() + DateTimeUtils.roundToPrecision( jdbcOffsetTime.getNano(), 3 ) );
return (X) new Time( time.getTime() + DateTimeUtils.roundToPrecision( jdbcOffsetTime.getNano(), 3 ) / 1000000 );
}
final OffsetDateTime jdbcOffsetDateTime = jdbcOffsetTime.atDate( LocalDate.EPOCH );