Hates_ criteria answer didn’t seem to work for me; putting "last,first"
in order will only cause exceptions saying, "Property 'last,first' not found"
. To order on two fields, you can do the following:
def c = MyDomain.createCriteria()
def results = c.list {
and{
order('last','desc')
order('first','desc')
}
}
Related Contents:
- Why do I get a “Null value was assigned to a property of primitive type setter of” error message when using HibernateCriteriaBuilder in Grails
- Difference between findAll, getAll and list in Grails
- Checking if a collection is null or empty in Groovy
- What are “Groovy” and “Grails” and what kinds of applications are built using them?
- Clojure 1.2.1/1.3/1.4 ‘proxy generated in Grails 2.0.0 runtime fails. 1.2.0 is fine
- How to change grails localhost port?
- Connect to H2 database using IntelliJ database client
- Found shared references to a collection org.hibernate.HibernateException
- Grails vs Roo – why SpringSource is pushing two very similar technologies?
- How to access Grails configuration in Grails 2.0?
- Grails BuildConfig.groovy, difference between build, compile, and runtime?
- Using “$” in Groovy
- How can I return a 404/50x status code from a Grails Controller?
- Grails domain class: unique constraint for multiple columns
- Bcrypt generates different hashes for the same input?
- How can i set default value in grails domain class
- Overriding grails.views.default.codec=’html’ config back to ‘none’
- Multiple “order by” in LINQ
- Posting a File and Associated Data to a RESTful WebService preferably as JSON
- MySQL Orderby a number, Nulls last
- MySQL order by before group by
- How to order by with union in SQL?
- how to customize `show processlist` in mysql?
- What is the purpose of Order By 1 in SQL select statement?
- MySQL: Sort GROUP_CONCAT values
- SQL order string as number
- How to use SQL Order By statement to sort results case insensitive?
- Order a List (C#) by many fields? [duplicate]
- How to use Oracle ORDER BY and ROWNUM correctly?
- How do I return rows with a specific value first?
- MySQL – ORDER BY values within IN()
- MySQL: Order by field size/length
- Sorting related items in a Django template
- How to pass parameters to a modal?
- Can I do a max(count(*)) in SQL?
- SQL Order By Count
- What is the correct target for the JAVA_HOME environment variable for a Linux OpenJDK Debian-based distribution?
- MySQL ORDER BY IN()
- ORDER BY using Criteria API
- How do I order my SQLITE database in descending order, for an android app?
- The order of a SQL Select statement without Order By clause
- How to configure a session timeout for Grails application?
- MySQL order by “best match”
- What does “ORDER BY (SELECT NULL)” mean?
- Using MySql, can I sort a column but have 0 come last?
- SQLite and custom order by
- How to order 1,2,3 not 1, 10, 11, 12 in mySQL
- PostgreSQL – repeating rows from LIMIT OFFSET
- Select the 3 most recent records where the values of one column are distinct
- Use own IComparer with Linq OrderBy