I'm brand new to Play! and I'm using the version 2.3.4.
So far I used the java.util.Date
type without problem but I finally want to use a DateTime
type.
So I'm trying to use the org.joda.time.DateTime
type but anorm
doesn't know how to handle this type, I get this error : could not find implicit value for parameter extractor: anorm.Column[org.joda.time.DateTime]
.
The part of the code giving an error is :
private val ArtistParser: RowParser[Artist] = {
get[Long]("artistId") ~
get[DateTime]("creationDateTime") map {
case artistId ~ creationDateTime =>
Artist(artistId, creationDateTime)
}
}
My class is simply :
case class Artist (artistId: Long, creationDateTime: DateTime)
I have been searching a solution for a long time and I looked in particular at this post : Joda DateTime Field on Play Framework 2.0's Anorm but I think that it doesn't work with play 2.3.4 (at least I didn't manage to make it work).
So my question is how do you handle DateTime
with play scala 2.3? Is there an easiest way to proceed? And if not what should I do in order to anorm
to handle correctly the DateTime
type?
Anorm typeclasses for Joda DateTime
and Instant
are present in play master. You may want to give it a try.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.