[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3238) impossible to get the rowcount for a criteria that has projections

Serge P. Nekoval (JIRA) noreply at atlassian.com
Mon Sep 1 03:38:14 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3238?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Serge P. Nekoval updated HHH-3238:
----------------------------------

    Attachment: CriteriaCount.java

Criteria row counter snippet.

> impossible to get the rowcount for a criteria that has projections
> ------------------------------------------------------------------
>
>                 Key: HHH-3238
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3238
>             Project: Hibernate3
>          Issue Type: Bug
>    Affects Versions: 3.2.6
>         Environment: hibernate 3.2.6, oracle 10g
>            Reporter: hbMailingList
>         Attachments: CriteriaCount.java
>
>
> Projections.rowCount correctly returns the NUMBER_OF_ROWS for the criteria's resultset.
> However if the criteria already has a projection then rowcount no longer returns the NUMBER_OF_ROWS in the result set.
> For example:
> Criteria c=session.CreateCriteria(Cat.class);
> ProjectionList pl = ...;
> ....
> pl.add(Projections.groupProperty("color"));
> pl.add(Projections.rowCount());
> c.setProjections(pl);
> c.list();
> will result in the following query:
> select color, count(*) from cats group by color
> I would expect it to result in:
> select count(*) from (select color from cats group by color)
> after all if I wanted the count by color I could have simply done:
> Projections.count(...)
> I really need this feature for my project...if you don't think this will make the release, would you please give me a hint and I'll submit a patch.
> Thanks for all the hard work.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list