[
https://issues.apache.org/jira/browse/CAY-2836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nikita Timofeev closed CAY-2836.
--------------------------------
Resolution: Fixed
*4.2*:
https://github.com/apache/cayenne/commit/8b4c46e757e08f7b7d92275e202d694a2db6c616
*5.0*:
https://github.com/apache/cayenne/commit/7802667fc288a1d2e89d90e6893b97b2d24e6d58
> ObjectSelect.selectCount() throws if a query contains ordering
> --------------------------------------------------------------
>
> Key: CAY-2836
> URL: https://issues.apache.org/jira/browse/CAY-2836
> Project: Cayenne
> Issue Type: Bug
> Affects Versions: 4.2
> Reporter: Andrus Adamchik
> Assignee: Nikita Timofeev
> Priority: Minor
> Fix For: 4.2.3, 5.0-M2
>
>
> 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.
> {noformat}
> 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)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)