Change default for max attribute on results for @Resource on domain classes for Grails 2.3.x
I'm working on an app that serves domain classes as json results. Is there a way to change the default max for the results?
What I'm doing is http://site/domain-class.json and I'm only getting 10 results. I want to avoid creating all the links as http://site/domain-class.json?max=999
Is there a way to increase that default value to something different? I tried searching the source code without any luck. :(
That's not configurable using the @Resource annotation.
However, you can always generate your controller for your domain and modify the implementation of the list() method to have a different default maximum.
Here is the controller which backs a domain which is marked with the @Resource interface annotation. As you can see the default maximum value is not driven by any configuration value.
Using grails generate-controller for your domain will allow you to change that value in the generated controller for your domain.