I have a User class and a Item class and a user can have multiple items.
I want to select some users based on other property using finndAllByProperty and adding the pagination parameters (see http://www.grails.org/doc/1.2.2/ref/Domain%20Classes/findAllBy.html .)
The problem is that I want to sort the result based on how many items each user has So I would like to make something like:
myUsers = User.findAllByProperty(propertyInstance,[max:10, offset:offset, sort:'items.size()', order:"desc"])
but of course that "sort:'items.size()' " does not work. Is it any way to do this without adding a itemsNr property in the User domain that will update on each items added/removed ?