原文: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. POJ 3694 Network(无向图求桥+重边处理+LCA)

    题目大意: 给你一个无向图,然后再给你一个Q代表有Q次询问,每一次加一条边之后还有几座桥.在这里要对重边进行处理. 每次加入一条边之后,在这条搜索树上两个点的公共祖先都上所有点的桥都没了. 这里重边的 ...

  2. 去掉cell边框的简单办法

    实很简单,把backgroundView设置为一个空的View,然后就干净了 UIView *tempView = [[UIView alloc] init]; [cell setBackground ...

  3. 后缀数组:SPOJ SUBST1 - New Distinct Substrings

    Given a string, we need to find the total number of its distinct substrings. Input T- number of test ...

  4. CodeForces 591B

    题目链接: http://codeforces.com/problemset/problem/591/B 题意: 给你一串字符串,字符串里的字符全是a-z的小写字母,下面的m行,是字符串的交换方式, ...

  5. POJ 2912 Rochambeau

    题意:有一些人玩石头剪刀布,其中有一个人(称其为裁判)可以出“石头”,“剪刀”,“布”中的任意一个,其他人永远只能出相同的一个.即有的人只能出剪刀,有的人只能出石头,有的人只能出布.进行了多次对决,每 ...

  6. Lost's revenge - HDU 3341 (自动机+DP)

    题目大意:先给你一些子串,然后给你一个母串,母串里面的字母可以任意调换位置,问最多这个母串经过一些位置变动最多能包含多少个子串.   分析:可以比较明显的看出来的DP,先求出来ATGC分别有多少,然后 ...

  7. HDU 1247

    简单的字典树 - -,求一个单词是否由两个单词组成 #include<iostream> #include<cstring> #include<cstdio> us ...

  8. PL/SQL Developer 与tnsnames.ora

    PL/SQL Developer 是一款流行的oracle开发与管理的IDE. 在登录PL/SQL Developer时所选择的数据库依赖于tnsnames.ora文件中的信息. 如果我们安装了多个o ...

  9. Redis sort命令

    http://www.cnblogs.com/linjiqin/archive/2013/06/14/3135921.html 1.添加 投票选项到 redis的  List 和HashMap lis ...

  10. Android eclipse下数据开源框架GreenDao的配置

    1.前言 ORM(Object-RelationMapping,对象关系映射),是一种为了解决面向对象与数据库存在的互一匹配的现象的技术,通过描述对象和关系数据库之间的映射,将程序中的对象自动持久化到 ...