Grails
  1. Grails
  2. GRAILS-8380

Automatically disable order by clause for count() with where/named queries

    Details

    • Type: Improvement Improvement
    • Status: In Progress
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0-RC2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      It's fairly common with pagination to want to use the same query to both return the results and the total count. It's also convenient to include some sorting into Where or Named queries. However, if you call count() on them while they have sorting options, the query will fail.

      It would be great if Grails automatically ignored any sort options when calling count() or equivalent.

        Issue Links

          Activity

          Hide
          Jeff Scott Brown added a comment -

          I am reopening the issue as it is only fixed for named queries. It needs to be fixed for where queries as well.

          Show
          Jeff Scott Brown added a comment - I am reopening the issue as it is only fixed for named queries. It needs to be fixed for where queries as well.

            People

            • Assignee:
              Jeff Scott Brown
              Reporter:
              Peter Ledbrook
            • Votes:
              1 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Last Reviewed:

                Development