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