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

com.jwebmp.entityassist.converters.LocalDateTimeAttributeConverter Maven / Gradle / Ivy

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