Uploaded image for project: 'DeltaSpike'
  1. DeltaSpike
  2. DELTASPIKE-714

QueryResult.count not work if jpql have order by

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0.2
    • 1.3.0
    • Data-Module
    • None

    Description

      I have a entity which have a field scannedDate, create a repository with method findByXXX() which return a QueryResult.

      If I call QueryResult.orderAsc("scannedDate").count(), this error will happen.
      ERROR: column "t0.scanneddate" must appear in the GROUP BY clause or be used in an aggregate function

      I use openjpa 2.2, We cannot simply remove the "order by", Because if we order by a attribute of associated entity like order by e.foo.bar, JPA engine will generate a inner join, if we simply remove the "order by" the count result will not correct.

      Maybe this is not a bug, just a limitation.

      Attachments

        Activity

          People

            thomashug Thomas Hug
            chunlinyao chunlinyao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: