Issue Type: Bug Bug
Affects Versions: 4.1.9
Assignee: Unassigned
Components: query-hql
Created: 11/Jun/13 4:32 AM
Description:

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)=?

Environment: Hibernate 4.1.9, SQL Server 2008
Project: Hibernate ORM
Labels: hibernate jpa2 HQL
Priority: Minor Minor
Reporter: Jean-René Sirieix
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