You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2015/11/09 12:10:10 UTC
[jira] [Commented] (CAY-2037) EJBQL: COUNT(DISTINCT .. ) doesn't
properly translate paths ending with relationship
[ https://issues.apache.org/jira/browse/CAY-2037?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14996382#comment-14996382 ]
Andrus Adamchik commented on CAY-2037:
--------------------------------------
a temporary workaround is to rely on a distinct attribute of the target object when possible. E.g. change COUNT(DISTINCT p.artist) to COUNT(DISTINCT p.artist.name).
> EJBQL: COUNT(DISTINCT .. ) doesn't properly translate paths ending with relationship
> ------------------------------------------------------------------------------------
>
> Key: CAY-2037
> URL: https://issues.apache.org/jira/browse/CAY-2037
> Project: Cayenne
> Issue Type: Bug
> Affects Versions: 4.0.M2
> Reporter: Andrus Adamchik
> Assignee: Andrus Adamchik
>
> Per http://mail-archives.apache.org/mod_mbox/cayenne-user/201510.mbox/%3C23A9D9A5-62EA-4B59-B5AD-57150A1A8349%40karlmenn.is%3E
> I did some investigation, and in most cases COUNT(DISTINCT ..) does the right thing. Except when a path inside count ends in relationship (e.g. COUNT(DISTINCT p.artist)), in which case it generates SQL "COUNT (DISTINCT *)" that produces incorrect result.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)