com.xlrit.gears.base.persistence.PeriodDurationConverter Maven / Gradle / Ivy
package com.xlrit.gears.base.persistence;
import jakarta.persistence.AttributeConverter;
import jakarta.persistence.Converter;
import org.threeten.extra.PeriodDuration;
@Converter(autoApply = true)
public class PeriodDurationConverter implements AttributeConverter {
public String convertToDatabaseColumn(PeriodDuration value) {
if (value == null) return null;
return value.toString();
}
public PeriodDuration convertToEntityAttribute(String s) {
if (s == null) return null;
return PeriodDuration.parse(s);
}
}