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

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

There is a newer version: 0.68.0.1
Show newest version
package com.jwebmp.entityassist.converters;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import java.io.Serializable;
import java.sql.Date;
import java.time.LocalDate;

@Converter()
public class LocalDateAttributeConverter implements AttributeConverter, Serializable
{

	@Override
	public Date convertToDatabaseColumn(LocalDate locDate)
	{
		return (locDate == null ? null : Date.valueOf(locDate));
	}

	@Override
	public LocalDate convertToEntityAttribute(Date sqlDate)
	{
		return (sqlDate == null ? null : sqlDate.toLocalDate());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy