You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks! Note that for now you can add a converter class, e.g.
importjava.time.Instant;
importjava.util.Date;
/** * Converts an {@link Instant} to a {@link Date} to store in the database. Hence, if the instant represents a time too * far into the future or past that does not fit long milliseconds an exception is thrown. * <p> * Note that on some hardware this may lead to a loss in precision, e.g. if it supports microsecond or nanosecond time. * Use a custom {@link PropertyConverter} to store time with higher precision. */publicclassInstantToDateConverterimplementsPropertyConverter<Instant, Date> {
@OverridepublicInstantconvertToEntityProperty(DatedatabaseValue) {
if (databaseValue == null) {
returnnull;
}
returndatabaseValue.toInstant();
}
@OverridepublicDateconvertToDatabaseValue(InstantentityProperty) {
if (entityProperty == null) {
returnnull;
}
returnnewDate(entityProperty.toEpochMilli());
}
}
The "Date" property is outdated with Java 8 Time API, it would be nice to have Instant instead.
The text was updated successfully, but these errors were encountered: