Uploaded image for project: 'Cayenne'
  1. Cayenne
  2. CAY-2836

ObjectSelect.selectCount() throws if a query contains ordering

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.2
    • 4.2.2, 5.0-M2
    • None
    • None

    Description

      This was reported to me privately. According to the report, when ObjectSelect has an ordering, "selectCount()" throws. While ordering should not be needed to retrieve a count, semantically there's nothing wrong with such a combo, and the query should not fail.

      org.apache.cayenne.CayenneRuntimeException: [v.4.2 May 16 2023 08:31:12] Expected zero or one object, instead query matched: 54
      	at org.apache.cayenne.BaseContext.selectOne(BaseContext.java:320)
      	at org.apache.cayenne.query.FluentSelect.selectOne(FluentSelect.java:170)
      	at org.apache.cayenne.query.ObjectSelect.selectCount(ObjectSelect.java:681)
      

      Attachments

        Activity

          People

            ntimofeev Nikita Timofeev
            andrus Andrus Adamchik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: