@Override
public String convertToDatabaseColumn(Duration duration)
{
+ if (duration == null)
+ return null;
return duration.toString();
}
@Override
public Duration convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return Duration.parse(string);
}
}
@Override
public Timestamp convertToDatabaseColumn(Instant instant)
{
+ if (instant == null)
+ return null;
return Timestamp.from(instant);
}
@Override
public Instant convertToEntityAttribute(Timestamp ts)
{
+ if (ts == null)
+ return null;
return ts.toInstant();
}
}
@Override
public Date convertToDatabaseColumn(LocalDate ld)
{
+ if (ld == null)
+ return null;
return Date.valueOf(ld);
}
@Override
public LocalDate convertToEntityAttribute(Date date)
{
+ if (date == null)
+ return null;
return date.toLocalDate();
}
}
@Override
public Timestamp convertToDatabaseColumn(LocalDateTime ldt)
{
+ if (ldt == null)
+ return null;
return Timestamp.valueOf(ldt);
}
@Override
public LocalDateTime convertToEntityAttribute(Timestamp ts)
{
+ if (ts == null)
+ return null;
return ts.toLocalDateTime();
}
}
@Override
public Time convertToDatabaseColumn(LocalTime lt)
{
+ if (lt == null)
+ return null;
return Time.valueOf(lt);
}
@Override
public LocalTime convertToEntityAttribute(Time time)
{
+ if (time == null)
+ return null;
return time.toLocalTime();
}
}
@Override
public String convertToDatabaseColumn(Locale locale)
{
+ if (locale == null)
+ return null;
return locale.toLanguageTag();
}
@Override
public Locale convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return Locale.forLanguageTag(string);
}
}
@Override
public String convertToDatabaseColumn(MonthDay monthday)
{
+ if (monthday == null)
+ return null;
return monthday.toString();
}
@Override
public MonthDay convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return MonthDay.parse(string);
}
}
@Override
public Timestamp convertToDatabaseColumn(OffsetDateTime odt)
{
+ if (odt == null)
+ return null;
return Timestamp.from(odt.withOffsetSameInstant(ZoneOffset.UTC).toInstant());
}
@Override
public OffsetDateTime convertToEntityAttribute(Timestamp ts)
{
+ if (ts == null)
+ return null;
return OffsetDateTime.of(ts.toLocalDateTime(), ZoneOffset.UTC);
}
}
@Override
public Time convertToDatabaseColumn(OffsetTime ot)
{
+ if (ot == null)
+ return null;
ZoneOffset offset = ot.getOffset();
return Time.valueOf(ot.withOffsetSameInstant(ZoneOffset.UTC).toLocalTime());
}
@Override
public OffsetTime convertToEntityAttribute(Time time)
{
+ if (time == null)
+ return null;
return OffsetTime.of(time.toLocalTime(), ZoneOffset.UTC);
}
}
@Override
public String convertToDatabaseColumn(Period period)
{
+ if (period == null)
+ return null;
return period.toString();
}
@Override
public Period convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return Period.parse(string);
}
}
@Override
public Long convertToDatabaseColumn(TemporalAmount amount)
{
+ if (amount == null)
+ return null;
return amount.get(ChronoUnit.DAYS);
}
@Override
public TemporalAmount convertToEntityAttribute(Long days)
{
+ if (days == null)
+ return null;
return Duration.ofDays(days);
}
}
@Override
public Long convertToDatabaseColumn(TemporalAmount amount)
{
+ if (amount == null)
+ return null;
return amount.get(ChronoUnit.HOURS);
}
@Override
public TemporalAmount convertToEntityAttribute(Long hours)
{
+ if (hours == null)
+ return null;
return Duration.ofHours(hours);
}
}
@Override
public Long convertToDatabaseColumn(TemporalAmount amount)
{
+ if (amount == null)
+ return null;
return amount.get(ChronoUnit.MICROS);
}
@Override
public TemporalAmount convertToEntityAttribute(Long micros)
{
+ if (micros == null)
+ return null;
return Duration.of(micros, ChronoUnit.MICROS);
}
}
@Override
public Long convertToDatabaseColumn(TemporalAmount amount)
{
+ if (amount == null)
+ return null;
return amount.get(ChronoUnit.MILLIS);
}
@Override
public TemporalAmount convertToEntityAttribute(Long millis)
{
+ if (millis == null)
+ return null;
return Duration.ofMillis(millis);
}
}
@Override
public Long convertToDatabaseColumn(TemporalAmount amount)
{
+ if (amount == null)
+ return null;
return amount.get(ChronoUnit.MINUTES);
}
@Override
public TemporalAmount convertToEntityAttribute(Long minutes)
{
+ if (minutes == null)
+ return null;
return Duration.ofMinutes(minutes);
}
}
@Override
public Long convertToDatabaseColumn(TemporalAmount amount)
{
+ if (amount == null)
+ return null;
return amount.get(ChronoUnit.NANOS);
}
@Override
public TemporalAmount convertToEntityAttribute(Long nanos)
{
+ if (nanos == null)
+ return null;
return Duration.ofNanos(nanos);
}
}
@Override
public Long convertToDatabaseColumn(TemporalAmount amount)
{
+ if (amount == null)
+ return null;
return amount.get(ChronoUnit.SECONDS);
}
@Override
public TemporalAmount convertToEntityAttribute(Long seconds)
{
+ if (seconds == null)
+ return null;
return Duration.ofSeconds(seconds);
}
}
@Override
public String convertToDatabaseColumn(URI uri)
{
+ if (uri == null)
+ return null;
return uri.toASCIIString();
}
@Override
public URI convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return URI.create(string);
}
}
@Override
public String convertToDatabaseColumn(URL url)
{
+ if (url == null)
+ return null;
try
{
return url.toURI().toASCIIString();
@Override
public URL convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
try
{
return URI.create(string).toURL();
@Override
public Integer convertToDatabaseColumn(Year year)
{
+ if (year == null)
+ return null;
return year.getValue();
}
@Override
public Year convertToEntityAttribute(Integer integer)
{
+ if (integer == null)
+ return null;
return Year.of(integer);
}
}
@Override
public String convertToDatabaseColumn(YearMonth yearmonth)
{
+ if (yearmonth == null)
+ return null;
return yearmonth.toString();
}
@Override
public YearMonth convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return YearMonth.parse(string);
}
}
@Override
public String convertToDatabaseColumn(ZoneId zone)
{
+ if (zone == null)
+ return null;
return zone.getId();
}
@Override
public ZoneId convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return ZoneId.of(string);
}
}
@Override
public String convertToDatabaseColumn(ZoneOffset offset)
{
+ if (offset == null)
+ return null;
return offset.getId();
}
@Override
public ZoneOffset convertToEntityAttribute(String string)
{
+ if (string == null)
+ return null;
return ZoneOffset.of(string);
}
}
@Override
public Timestamp convertToDatabaseColumn(ZonedDateTime zdt)
{
+ if (zdt == null)
+ return null;
return Timestamp.from(zdt.withZoneSameInstant(ZoneId.systemDefault()).toInstant());
}
@Override
public ZonedDateTime convertToEntityAttribute(Timestamp ts)
{
+ if (ts == null)
+ return null;
return ZonedDateTime.ofInstant(ts.toInstant(), ZoneId.systemDefault());
}
}