diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeJavaType.java index 9e469cd118..f83a1845b3 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/JdbcTimeJavaType.java @@ -188,7 +188,7 @@ public class JdbcTimeJavaType extends AbstractTemporalJavaType { 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 ) { diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java index b1d7206bba..e245fb3cfa 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/LocalTimeJavaType.java @@ -88,7 +88,7 @@ public class LocalTimeJavaType extends AbstractTemporalJavaType { 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 diff --git a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/OffsetTimeJavaType.java b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/OffsetTimeJavaType.java index 0577c7f109..1d949cdd0a 100644 --- a/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/OffsetTimeJavaType.java +++ b/hibernate-core/src/main/java/org/hibernate/type/descriptor/java/OffsetTimeJavaType.java @@ -105,7 +105,7 @@ public class OffsetTimeJavaType extends AbstractTemporalJavaType { 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 );