Slick column mapper java.sql.Time to Joda LocalTime

398 Views Asked by At

Looking to map java.sql.time to some joda time class. Having some issues with the mapper, it throws an error message. Has anyone performed this conversion?

trait DateMapper {
  implicit val DateMapper =
    MappedColumnType .base[java.sql.Time, org.joda.time.LocalTime] (
      d => new LocalTime(d.getTime))

}

Error

Unspecified value parameters: tcomap:(LocalTime) => Time
1

There are 1 best solutions below

0
On BEST ANSWER

The issue is that you are missing the LocalTime => Time conversion for ResultSet -> Scala Collection conversion:

MappedColumnType.base[java.sql.Time, org.joda.time.LocalTime] (
  time => new LocalTime(time.getTime),
  localTime => new Time(localTime.toDateTimeToday().getMillis()))