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

Show:
Brett Meyer
July 8, 2014, 3:11 PM

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!

Brett Meyer
April 7, 2014, 5:43 PM

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!

Gail Badner
April 22, 2010, 7:41 PM

Eric, thanks for checking!

Eric Citaire
April 22, 2010, 10:45 AM

Same problem with 3.5.1-Final version.

Eric Citaire
April 22, 2010, 12:03 AM

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.

Rejected

Assignee

Unassigned

Reporter

Eric Citaire

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Critical