The Grails Framework 3.1.10

See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # last ## Purpose Retrieves the last instance of the domain class. ## Examples Given the domain class:
    class Person {
        String firstName
        String lastName
        Integer age
    }

    // retrieve the last person ordered by the identifier
    def p = Person.last()// retrieve the last person ordered by the lastName property
    p = Person.last(sort: 'lastName')// retrieve the last person ordered by the lastName property
    p = Person.last('lastName')
Parameters: `sort` (optional) - The name of the property to sort by See also: first Note that the first() and last() methods are not supported on domain classes which use a composite primary key. | Quick Reference (hide)