[hibernate-issues] [Hibernate-JIRA] Created: (HHH-4957) Criteria Projections.countDistinct() function broken

Lin Lai Fu (JIRA) noreply at atlassian.com
Fri Feb 26 06:19:47 EST 2010


Criteria Projections.countDistinct() function broken
----------------------------------------------------

                 Key: HHH-4957
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4957
             Project: Hibernate Core
          Issue Type: Bug
          Components: core
    Affects Versions: 3.5.0-CR-2
         Environment: Hibernate: 3.5.0-CR-2
OS: Windows XP (should be OS independent)
IDE: Eclipse 3.5 Galileo
            Reporter: Lin Lai Fu
            Priority: Blocker


The criteria countDistinct() does not generate the correct query:

criteria.setProjection(Projections.countDistinct("id"));

generates: select count(id)
instead of: select count(distinct id)

This used to work in version 3.3.2-GA with toSqlString(). This method is missing in 3.5.0


Working version in 3.3.2-GA: http://viewvc.jboss.org/cgi-bin/viewvc.cgi/hibernate/core/trunk/core/src/main/java/org/hibernate/criterion/CountProjection.java?revision=14993&view=markup
Broken version in 3.5.0: http://viewvc.jboss.org/cgi-bin/viewvc.cgi/hibernate/core/trunk/core/src/main/java/org/hibernate/criterion/CountProjection.java?revision=17874&view=markup

See also the forum thread: http://forum.hibernate.org/viewtopic.php?f=1&t=1002910

-- 
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