
com.jwebmp.entityassist.converters.LocalDateTimeAttributeConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of entity-assist Show documentation
Show all versions of entity-assist Show documentation
A Domain Driven SQL Builder Generator for JPMS/JDK8
package com.jwebmp.entityassist.converters;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import java.sql.Timestamp;
import java.time.LocalDateTime;
@Converter()
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 - 2025 Weber Informatics LLC | Privacy Policy