【发布时间】:2013-01-15 02:26:50
【问题描述】:
使用以下数据库脚本:
# Tasks schema
# --- !Ups
CREATE TABLE HashToUrl (
hash integer,
url varchar(255)
);
# --- !Downs
DROP TABLE HashToUrl;
...为什么会出现此错误:
[NoSuchElementException: key not found: hash]
...对于这个方法
def getTask(hash: Int): String = DB.withConnection { implicit c =>
val result = SQL(
"""
select count(*) as url from HashToUrl where hash={hash}
"""
).apply().head
val url = result[String]("url")
url
}
【问题讨论】:
标签: scala playframework playframework-2.0 anorm