All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xlrit.gears.base.persistence.PeriodDurationConverter Maven / Gradle / Ivy

There is a newer version: 1.17.5
Show newest version
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);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy