de.adorsys.ledgers.postings.impl.converter.LocalDateTimeAttributeConverter Maven / Gradle / Ivy
package de.adorsys.ledgers.postings.impl.converter;
import java.sql.Timestamp;
import java.time.LocalDateTime;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
@Converter(autoApply = true)
public class LocalDateTimeAttributeConverter implements AttributeConverter {
@Override
public Timestamp convertToDatabaseColumn(LocalDateTime locDateTime) {
return locDateTime == null
? null
: Timestamp.valueOf(locDateTime);
}
@Override
public LocalDateTime convertToEntityAttribute(Timestamp sqlTimestamp) {
return sqlTimestamp == null
? null
: sqlTimestamp.toLocalDateTime();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy