Changing the default list method

the default list method in generated controllers looks like this:

<code>
    @Property list = {
        [ exampleList: Example.list( params ) ]
    }
</code>

This can be changed to return results however you need. For example, to execute an HQL statement to return the results in reverse order of id, use the following:

<code>
    @Property list = {
        [ exampleList: Example.findAll( "from Example order by id desc", params ) ]
    }
</code>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.