首页 > 数据库技术 > 详细

grails通过findBy或findBy查找的结果集进行排序

时间:2014-05-23 11:42:25      阅读:1342      评论:0      收藏:0      [点我收藏+]

原文:http://grails.org/doc/2.3.x/ref/Domain%20Classes/list.html

list

Purpose

Lists 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"])

When max is specified as a named argument this will return a PagedResultList which has a getTotalCount() method to return the total number of matching records for pagination. Two queries are still run, but they‘re run for you and the results and total count are combined in the PagedResultList.

Description

Parameters:

  • max - The maximum number to list,要列出的最大数目
  • offset - The offset from the first result to list from
  • order - How to order the list, 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

grails通过findBy或findBy查找的结果集进行排序,布布扣,bubuko.com

grails通过findBy或findBy查找的结果集进行排序

原文:http://www.cnblogs.com/smallrock/p/3737296.html

(1)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!