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

de.adorsys.ledgers.postings.impl.converter.LocalDateTimeAttributeConverter Maven / Gradle / Ivy

There is a newer version: 4.17
Show newest version
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