【发布时间】:2013-11-30 05:17:09
【问题描述】:
我有一个 postgres 表 -
CREATE TABLE "Contest"
(
id serial NOT NULL,
name varchar(100) NOT NULL,
type char(1) NOT NULL,
status char(1) NOT NULL,
...
)
我正在尝试将字段值 type 和 status 返回到我的 Play 2.x (Anorm) 应用程序:
val parseContest = {
get[Pk[Int]]("id") ~
get[String]("name") ~
get[Char]("type") ~
get[Char]("status") map {
case id~name~c_type~status =>
Contest(id, name, c_type, status)
}
}
并得到错误:
could not find implicit value for parameter extractor: anorm.Column[Char]
异常似乎不支持“Char”。
我应该在我的代码中更改什么?使用get[String]("status") 然后status.head 作为解决方法是一种好习惯吗?
【问题讨论】:
标签: postgresql scala playframework-2.0 anorm