I'm just trying to paginate, but so far I have not been able to do this. I have 2 domain classes and one to many relationships.
class User {
static hasMany = [contacts:Contact]
}
class Contact {
static belongsTo = [ user : User ]
}
I have 20 contacts.
When I tried to make a request like this:
def maxResult = 20
def startIndex = 0
def contacts = Contact.findAllByUser(user, [max:maxResult, offset:startIndex])
he does not work. The request works, but pagination with gorm does not work. The result is only 1 contact object.
when i tried;
def startIndex = 0
def contacts = Contact.findAllByUser(user, [offset:startIndex])
The result is 20 contact objects, but when I tried it with a different startIndex value, it also does not work. for startIndex = 5, the result is also 20 ontact objects.
Does anyone have any ideas about this. Maybe I'm doing something wrong, maybe it's a hail problem. I did not find the answer. Thank you for your responses.
source
share