Skip to content

Commit 40e10b1

Browse files
committed
updated method to add the nanoseconds properly
-all unit test work with this update
1 parent bd9d86f commit 40e10b1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/info/unterrainer/commons/rdbutils/converters/LocalDateTimeConverter.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import jakarta.persistence.AttributeConverter;
1010
import jakarta.persistence.Converter;
11-
11+
import liquibase.pro.packaged.db;
1212
import info.unterrainer.commons.jreutils.DateUtils;
1313

1414
@Converter()
@@ -23,8 +23,13 @@ public Timestamp convertToDatabaseColumn(final LocalDateTime entityValue) {
2323
return timestamp;
2424
}
2525

26+
// FIXXXING
2627
@Override
2728
public LocalDateTime convertToEntityAttribute(final Timestamp dbValue) {
28-
return dbValue == null ? null : DateUtils.epochToUtcLocalDateTime(dbValue.getTime());
29+
if (dbValue == null)
30+
return null;
31+
LocalDateTime ldt = DateUtils.epochToUtcLocalDateTime(dbValue.getTime());
32+
ldt = ldt.withNano(dbValue.getNanos());
33+
return ldt;
2934
}
3035
}

0 commit comments

Comments
 (0)