Search code examples
scalaormsqueryl

Select Query always runs into RuntimeException


I always run into RuntimeException when i invoke following query:

val app = from(appTable)(app => where (app.id === application_ID)
      select(app)).single

This query always throws a RuntimeException:

java.lang.RuntimeException: next called with no rows available

What is wrong with my query?


Solution

  • single means that you expect one and only one result of query. If resultset is empty you receive this exception. Use headOption method instead of single.