Search code examples
grailshqlgrails-orm

findAll exceptions with named parameters


I'm trying to do a findAll similar to one of the grails examples. This is what I have:

def beverage = Beverage.findAll("from Beverage as b where b.id in (:ids)",[ids: [1,2]])

and I'm getting:

java.lang.Integer cannot be cast to java.lang.Long


Solution

  • You just need to coerce the hard-coded ids to longs:

    [ids: [1L, 2L]]