Grails
  1. Grails
  2. GRAILS-8257

How to Order by association in DetachedCriteria

    Details

    • Type: Bug Bug
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0-RC1
    • Fix Version/s: None
    • Component/s: Persistence
    • Labels:
      None
    • Environment:
      Lion,JDK 6

      Description

      the original url: http://grails.1312388.n4.nabble.com/How-to-Order-by-association-in-DetachedCriteria-td3988989.html

      I have tried like these:

      bookingType

      { order('code','asc') }


      --there is no error and no expected result
      or

      order('bookingType.code','asc')
      --there is an exception.

        Activity

        Hide
        Landon Cheek added a comment -

        On a related note, it would be extremely useful if the parameters passed to .list() on DetachedCriteria worked the same way.

        Example:

          new DetachedCriteria(SomeDomain).build { /* Some criteria */ }.list(sort: 'someAssociatedProperty.name', order: 'asc')
        
        Show
        Landon Cheek added a comment - On a related note, it would be extremely useful if the parameters passed to .list() on DetachedCriteria worked the same way. Example: new DetachedCriteria(SomeDomain).build { /* Some criteria */ }.list(sort: 'someAssociatedProperty.name', order: 'asc')

          People

          • Assignee:
            Graeme Rocher
            Reporter:
            Ford Guo
          • Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development