原文: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查找的结果集进行排序的更多相关文章

  1. STL中vector的赋值,遍历,查找,删除,自定义排序——sort,push_back,find,erase

    今天学习网络编程,那个程序中利用了STL中的sort,push_back,erase,自己没有接触过,今天学习一下,写了一个简单的学习程序.编译环境是VC6.0         这个程序使用了vect ...

  2. 二分查找、two points、排序

    二分查找 1.查找某元素.循环条件 low <= high,最终结果位mid, 如果查询失败则返回-1. int binSearch(int num[], int low, int high, ...

  3. 九度OJ 1174:查找第K小数 (排序、查找)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:6376 解决:2539 题目描述: 查找一个数组的第K小的数,注意同样大小算一样大.  如  2 1 3 4 5 2 第三小数为3. 输入: ...

  4. 查找系列合集-二叉查找树BST

    一. 二叉树 1. 什么是二叉树? 在计算机科学中,二叉树是每个结点最多有两个子树的树结构. 通常子树被称作“左子树”(left subtree)和“右子树”(right subtree). 二叉树常 ...

  5. sql 表的部分字段查找 的结果集

    传统sql从多个对象中获得的list<Object> ,可以这样处理(利用Map)  List list = query.getList(sql);  //封装成BB类型  List< ...

  6. 常用查找数据结构及算法(Python实现)

    目录 一.基本概念 二.无序表查找 三.有序表查找 3.1 二分查找(Binary Search) 3.2 插值查找 3.3 斐波那契查找 四.线性索引查找 4.1 稠密索引 4.2 分块索引 4.3 ...

  7. [Data Structure & Algorithm] 七大查找算法

    查找是在大量的信息中寻找一个特定的信息元素,在计算机应用中,查找是常用的基本运算,例如编译程序中符号表的查找.本文简单概括性的介绍了常见的七种查找算法,说是七种,其实二分查找.插值查找以及斐波那契查找 ...

  8. MS - 1 - 把二元查找树转变成排序的双向链表

    ## 1. 把二元查找树转变成排序的双向链表 ## ### 题目: 输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表. ### 要求不能创建任何新的结点,只调整指针的指向. 10       ...

  9. 二分查找-python

    约12年年底的时候,接触了python不到半年的样子,入门是直接实现GUI测试case的.今天面试地平线机器人,发现忘得差不多了- -. 当时的问题是这样的 写一个二分查找是实现,我好像不记得二分查找 ...

随机推荐

  1. DIV+CSS布局问题:一个宽度不确定的DIV里面放三个水平对齐的DIV,左右两个DIV宽度固定为150px,中间那个DIV充满剩余的宽度

    一个入门的DIV+CSS布局问题:一个宽度不确定的DIV里面放三个水平对齐的DIV,左右两个DIV宽度固定为150px,中间那个DIV充满剩余的宽度. 说明:代码非真实情况下使用,所以直接简单. 没耐 ...

  2. Oulipo - HDU 1686 (KMP模板题)

    题目大意:题目叙述很多,其实只看输入输出也能明白什么意思,给两个串W,T, 判断T串中包含几个串W.   分析:还是基础的KMP应用....................... 直接上代码. === ...

  3. Android WebView Error – Uncaught TypeError: Cannot call method ‘getItem’ of null at

    本质原因是js 没有判断dom 是否加载完毕 其实就是在dom 加载完毕之后处理事件 wv.getSettings().setDomStorageEnabled(true); 转自 蛙齋  http: ...

  4. 使用iScroll和photoswipe写手机浏览图片的插件的几点经验

    首先,当我知道我得到一个任务需要写一个在手机上能浏览图片的插件时,我第一想到了iScroll.它的左右滑动,上下滑动的效果在安卓手机上也能让用户有良好的体验,自己写也能方便控制. 我的需求是,插件要能 ...

  5. adb出现adb server is out of date时的解决的方法

    出错的原因是adb的port被其它程序的进程占据了,所以要做的就是找到并kill该进程.步骤:. 1.在cmd中运行adb nodaemon server,查看adb的port号是多少,普通情况下是5 ...

  6. springMVC3学习(二)--ModelAndView对象

    当控制器处理完请求时,一般会将包括视图名称或视图对象以及一些模型属性的ModelAndView对象返回到DispatcherServlet. 因此,常常须要在控制器中构造ModelAndView对象. ...

  7. cocos2d-x项目过程记录(Objective-C转C++)

    (原创作品,欢迎转载,注明出处,谢谢:http://www.cnblogs.com/binxindoudou/admin/EditPosts.aspx?postid=3179335) 1.单例模式中, ...

  8. java生成Json工具之JsonSimple的使用

    json-simple是由是Google开发的Java JSON解析框架,基于Apache协议.目前版本为1.1 项目主页:https://code.google.com/p/json-simple/ ...

  9. 鼠标双击范围基于Win7

    TP鼠标双击范围主要是修改Registry中的HKEY_CURRENT_USER\Control Panel\Mouse里面的两个参数 DoubleClickHeight跟DoubleClickWid ...

  10. 我也要这样写define、、

    今天在TCO1B看到这位大神的代码,简直醉了,当需要手速的时候可以考虑使用一下.. #define V(x) vector<x > #define vs V(string) #define ...