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

com.darwinsys.todo.database.DateConverter Maven / Gradle / Ivy

package com.darwinsys.todo.database;

import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

import com.darwinsys.todo.model.Date;

/** JPA Converter for our custom Date class */
@Converter
public class DateConverter implements AttributeConverter {

	@Override
	public String convertToDatabaseColumn(Date d) {
		if (d == null)
			return null;
		return d.toString();
	}

	@Override
	public Date convertToEntityAttribute(String s) {
		if (s == null)
			return null;
		return new Date(s);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy