次の DB スクリプトを使用します。
# 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
}