希望将java.sql.time映射到一些joda时间类。遇到映射器的一些问题,它会抛出一条错误消息。有没有人进行过这种转换?
trait DateMapper {
implicit val DateMapper =
MappedColumnType .base[java.sql.Time, org.joda.time.LocalTime] (
d => new LocalTime(d.getTime))
}
错误
Unspecified value parameters: tcomap:(LocalTime) => Time
答案 0 :(得分:3)
问题是您错过了LocalTime => Time
转化的ResultSet -> Scala Collection
转换:
MappedColumnType.base[java.sql.Time, org.joda.time.LocalTime] (
time => new LocalTime(time.getTime),
localTime => new Time(localTime.toDateTimeToday().getMillis()))