I have a service which returns a list of domain class objects to a controller. I’m looking for something to take pagination parameters and paginate this list like MyDomain.list(params) does. Any suggestions?
I have a service which returns a list of domain class objects to a
Share
Pass pagination params to your service method. If you do pagination after retrieving objects from database (in controller in your case), your query will still return many objects you don’t need and it can become a performance issue.
Otherwise if you still want to have pagination without gorm features, then you can just slice your list i.e.
def sliceList = list[5..10]