hql group by on multiple classes generates 1 query by class and can return a wrong number
of results
----------------------------------------------------------------------------------------------------
Key: HHH-5141
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5141
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.3.0.SP1
Environment: Hibernate Annotations 3.4.0.GA, HSQLDB 1.8.0.10
Reporter: Eric Citaire
Priority: Critical
The classes DomesticDog and DomesticCat extend / implement Pet.
Here is the data of the 2 tables :
{{DomesticDog}}
{{+----+----------------------+}}
{{| 1 | Max |}}
{{| 2 | Buddy |}}
{{| 3 | Jake |}}
{{| 4 | Buddy |}}
{{+----+----------------------+}}
{{DomesticCat}}
{{+----+----------------------+}}
{{| 1 | Tiger |}}
{{| 2 | Smokey |}}
{{| 3 | Tiger |}}
{{| 4 | Max |}}
{{+----+----------------------+}}
Given the HQL query :
{{select pet.name from Pet pet group by pet.name having count(pet) > 1}}
Two SQL queries are generated and executed separately :
{{select domesticdog0_.name as col_0_0_ from DomesticDog domesticdog0_ group by
domesticdog0_.name having count(domesticdog0_.id)>1}}
{{select domesticcat0_.name as col_0_0_ from DomesticCat domesticcat0_ group by
domesticcat0_.name having count(domesticcat0_.id)>1}}
It returns only : "Buddy" and "Smokey". But it does not return
"Max" wich is the name of a cat and a dog.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira