# Grails 1.1 GORM查询 - 获取实例列表

**URL:** <https://www.isharkfly.com/t/grails-1-1-gorm/6607>\
**Category:** 程序语言\
**Created:** [November 4, 2012, 4:36am UTC](https://www.isharkfly.com/t/grails-1-1-gorm/6607 "2012-11-04T04:36:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [November 4, 2012, 4:36am UTC](https://www.isharkfly.com/t/grails-1-1-gorm/6607/1 "2012-11-04T04:36:00Z")

</div>

如果你简单的需要获得给定类的所有实例，你可以使用 list 方法:`def books = Book.list()`list 方法支持分页参数:`def books = Book.list(offset:10, max:20)`也可以排序:`def books = Book.list(sort:"title", order:"asc")`这里，Here, the sort 参数是您想要查询的domain类中属性的名字，argument is the name of the domain class property that you wish to sort on, and the order

参数要么以argument is either asc for asc结束ending or要么以 desc for desc结束ending.
