Are params a map of ints or strings? If the var collar_id
is a string, but you store it as an int when you query it wont find any results.
Here's an example of ensuring collar_id
is a valid int based on params of Map[string, Any]
:
val collar_id = params.getOrElse("collar_id", "1").toString match {
case x if x.forall(Character.isDigit) => x.toInt
case _ => 1
}