hql group by on multiple classes generates 1 query by class and can return a wrong number of results
Description
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.
Environment
Hibernate Annotations 3.4.0.GA, HSQLDB 1.8.0.10
Activity
Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!
In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.
If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.
Thank you!
Eric, thanks for checking!
Same problem with 3.5.1-Final version.
Nevermind, I found the version 3.5.1-Final on the JBoss repo. It must be filtered in our Archiva config. I'll test it and give you feed back.
Thanks.