For example, the hql query:
update City city set city.anything = :param where (select country.language from City citySub inner join citySub.country country where citySub = city) = :language
is translated as :
update CITY set ANYTHING=? where (select country2_.LAN_ID from CITY city1_ inner join COUNTRY country2_ on city1_.CTY_CTR_ID=country2_.CTR_ID where CTY_ID=CTY_ID)=?
The subquery is not filtered at all, it returns the languages of all cities, which results in an error.
When explicitly comparing ids in the where clause, the translation is correct, with fully-qualified ids:
update City city set city.anything = :param where (select country.language from City citySub inner join citySub.country country where citySub.id = city.id) = :language
update CITY set ANYTHING=? where (select country2_.LAN_ID from CITY city1_ inner join COUNTRY country2_ on city1_.CTY_CTR_ID=country2_.CTR_ID where city1_.CTY_ID=CITY.CTY_ID)=?
|