[seam-issues] [JBoss JIRA] (JBSEAM-4854) countQuery not correcly generated when group by is used

Tiago Peruzzo (JIRA) issues at jboss.org
Tue Sep 29 07:21:00 EDT 2015


    [ https://issues.jboss.org/browse/JBSEAM-4854?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13113211#comment-13113211 ] 

Tiago Peruzzo commented on JBSEAM-4854:
---------------------------------------

[~manaRH] I'm upgrading multiple projects (more than 40 projects in all) using the seam 2.2 to 2.3, have many classes with group by using EntityQuery that worked in version 2.2.

It would be too costly and risky to find all places where I have a sql with group by and change to set useWildcardAsCountQuerySubject to false.

Another issue is that the sql referenced in the bug is not wrong. The method makes the count properly, what do happens is that some providers do not support multiple distincts in the count or have a different semantics.

Mysql: 
select count(distinct year(e.receivedDate), quarter(e.receivedDate)) from Entity e;

Oracle:
select count (distinct trunc(e.receivedDate, 'year') || trunc(e.receivedDate, 'Q')) from Entity e;



> countQuery not correcly generated when group by is used
> -------------------------------------------------------
>
>                 Key: JBSEAM-4854
>                 URL: https://issues.jboss.org/browse/JBSEAM-4854
>             Project: Seam 2
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 2.3.0.ALPHA
>            Reporter: Sergio Angelo
>            Assignee: Marek Novotny
>             Fix For: 2.3.0.BETA1
>
>   Original Estimate: 4 hours
>  Remaining Estimate: 4 hours
>
> When an EntityQuery contains a group-by, then the select statement of the count-query is not correctly generated.
> Example query for reproducing the problem:
> select min(e.receivedDate), count(*) 
> from Entity e 
> where ... 
> groupby date_trunc('year', e.receivedDate), date_trunc('quarter', e.receivedDate)
> The count-query becomes as follows (which generates an exception when run):
> select distinct date_trunc('year', l.receivedDate), date_trunc('quarter', e.receivedDate)
> from etc.



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the seam-issues mailing list