(Quick Reference)

list

Purpose

Lists all of the instances of the domain class.

Examples

// list everything
def results = Book.list()
// list 10 results
def results = Book.list(max:10)
// list 10 results, offset by 100
def results = Book.list(max:10, offset:100)
// list 10 results, offset by 100, orderd by title in descending order
def results = Book.list(max:10, offset:100, sort:"title", order:"desc")

// list all books, eagerly fetching the authors association def results = Book.list(fetch:[authors:"eager"])

Description

Parameters:

  • max - The maximum number to list
  • offset - The offset from the first result to list from
  • order - The order to list by, either "desc" or "asc"
  • sort - The property name to sort by
  • ignoreCase - Whether to ignore the case when sorting. Default is true.
  • fetch - The fetch policy for the object's associations as a Map
  • readOnly - true if returned objects should not be automatically dirty-checked (simlar to read())
  • fetchSize - number of rows fetched by the underlying JDBC driver per round trip
  • flushMode - Hibernate FlushMode override, defaults to FlushMode.AUTO
  • timeout - query timeout in seconds