Is it possible to call namedQuery on grails inside the controller? I know that I can call namedQuery inside another namedQuery, but I don't want to do this. Any ideas? Thanks
User .groovy
static namedQueries = { filterUsers{ eq("age", 21) } }
MyController .groovy
def r = User.createCriteria().list { eq("id", 1) filterUsers() //not possible }
or..
MyController .groovy
//not possible too //Cannot invoke method createCriteria() on null object def r = User.filterUsers().createCriteria().list { eq("id", 1) }
source share