Issue Type: Bug Bug
Affects Versions: 4.1.4
Assignee: Unassigned
Attachments: hibernate-inherited-repeatedfield-test.zip
Components: query-hql
Created: 24/Jun/12 5:31 PM
Description:

I have a parent entity (Place) and 3 subentities called Town, Country and Place.

Subclasses Town and Country have a common field of type integer called "population"

When I make a JPQL query searching Places by population, the generated SQL filters only by the population field in "Town" entity, but ignores Country, so that the query does not return any country

The from-where generated clauses are:

from
PLACE place0_
left outer join
TOWN place0_1_
on place0_.PLACE_ID=place0_1_.PLACE_ID
left outer join
COUNTRY place0_2_
on place0_.PLACE_ID=place0_2_.PLACE_ID
left outer join
MOUNTAIN place0_3_
on place0_.PLACE_ID=place0_3_.PLACE_ID
where
place0_1_.NU_POPULATION>1000

For the query to be correct, the where statement should be
where
(place0_1_.NU_POPULATION>1000 OR place0_2_.NU_POPULATION>1000)

To run test-case, you will need maven 3. Run mvn test

Environment: Eclipse 3.7-SR2
Java 1.6u30
Hibernate ORM 4.1.4 (JPA)
H2 Database 1.3.167
Spring 3.1.1
Project: Hibernate ORM
Labels: query jpa2 HQL
Priority: Minor Minor
Reporter: Roberto Ruiz
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira