I am using Play 2.1.4 against a postgresql db. In the postgresql db, I am using uuid as my pk datatype, which correlates to java.util.UUID. The SqlParser.getT function in anorm doesn't have an implicit extractor for java.util.UUID. That makes sense, because I don't think many people use it; however, I can't seem to find instructions on how I can add one. Does anyone know how to add an additional implicit extractor to anorm.SqlParser in Play?
The error I am getting is below:
could not find implicit value for parameter extractor: anorm.Column[java.util.UUID]
I'm really new to Scala and Play, so if my approach is completely wrong, please let me know, but I'd really like to be able to do something like what you see below.
case class App(appId: UUID, appName: String, appServerName: String,
appComponent: String, appDescription: String,
appDateCreated: DateTime, appDateModified: DateTime,
appValidated: Boolean)
val app = {
get[UUID]("app_id") ~
get[String]("app_name") ~
get[String]("app_server_name") ~
get[String]("app_component") ~
get[String]("app_description") ~
get[java.util.Date]("app_date_created") ~
get[java.util.Date]("app_date_modified") ~
get[Boolean]("app_validated") map {
case id ~ name ~ serverName ~ component ~ description ~ dateCreated ~
dateModified ~ validated => App(id, name, serverName, component,
description, new DateTime(dateCreated.getTime),
new DateTime(dateModified.getTime), validated)
}
}
def all(): List[App] = DB.withConnection { implicit conn =>
SQL("SELECT * FROM apps").as(app *)
}