使用以下数据库脚本:
# Tasks schema
# --- !Ups
CREATE TABLE HashToUrl (
hash integer,
url varchar(255)
);
# --- !Downs
DROP TABLE HashToUrl;
...为什么我会收到此错误:
[NoSuchElementException:找不到键:哈希]
...对于这种方法
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
}