Timestamps lose microseconds in OrmBase.mapSqlType
dletin opened this issue · comments
dletin commented
java.sql.Timestamp is instance of java.util.Date.
The code below (in OrmBase.mapSqlType) truncates Timestamp precision to milliseconds
case Types.TIMESTAMP:
if (object instanceof java.util.Date) {
return new Timestamp(((java.util.Date) object).getTime()); // << microseconds are lost if object is already a Timestamp
}
break;
Simple solution:
case Types.TIMESTAMP:
if (object instanceof Timestamp) {
return object;
}
if (object instanceof java.util.Date) {
return new Timestamp(((java.util.Date) object).getTime());
}
break;
Leo Bayer commented
Thanks for reporting this! I've added your change and I think we'll try to push an update to maven central in the next day or so.
I asked @brettwooldridge if he can figure out how to give me privileges to publish to maven.
- Leo
Leo Bayer commented
sansorm-2.3 has been released to maven central.