grails通过findBy或findBy查找的结果集进行排序
2014-05-19 17:36
239 查看
原文:http://grails.org/doc/2.3.x/ref/Domain%20Classes/list.html
// 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
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
maxis 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
FlushModeoverride, defaults to
FlushMode.AUTO
timeout- query timeout in seconds
相关文章推荐
- 数据库之SQL ORDER BY 语句用于对结果集进行排序
- document.getElementsByClassName:简单的原生通过className查找元素,可指定多个样式名称进行查找
- RailsCasts中文版,#2 Dynamic find_by Methods 使用动态的find_by方法进行查找操作
- RailsCasts中文版,#2 Dynamic find_by Methods 使用动态的find_by方法进行查找操作
- 使用关键字对数组进行模糊查找;对一维字符串数组进行排序
- ASP ACCESS 按汉字拼音查找与排序, 最终修正版 By Stabx
- set不能通过指针元素指向的成员进行排序
- 对于一系列数据通过单击进行排序(每次只能单击一次)
- 随机产生N个整数,并对其进行排序,查找……
- 对查询结果集进行排序
- List排序 通过Comparable接口进行排序
- 容易遗忘的Comparable:一个结果集List,里面有很多的对象,要求根据对象的指定(age)字段进行排序
- 通过DataGrid列头对DataGrid内容进行排序
- 通过RMAN进行数据库恢复(step by step)
- 通过BitMap进行排序
- 通过findViewById()方法从layout中获取view并进行相应的转换时提示:"Cannot cast from View to AutoCompleteTextView"的解决办法!
- SQL进行排序、分组、统计的10个新技巧(个人总结)-------Mondify By LiFuyun
- 用C#实现将汉字转化为拼音,其实现原理就是先将汉字转化为内码,然后通过内码和拼音的对照表来进行查找。
- PB中通过单击数据窗口中的列来对数据进行排序
- std::find,std::find_if对类进行查找