HQL delete with subquery cause bad "where clause" in "SQL insert into ht_ table request" when parent and child table have the same key column name.
Query query = getCurrentSession().createQuery("delete com.company.product.domain.Cat c1 where c1 in (select c2 from com.company.product.domain.Cat c2 where c2.owner.firstname=aram_owner)");
generated SQL :
insert into HT_CAT select cat0_.ID as ID, ? from CAT cat0_ inner join ANIMAL cat0_1_ on cat0_.ID=cat0_1_.ID where ID in (select cat1_.ID from CAT cat1_ inner join ANIMAL cat1_1_ on cat1_.ID=cat1_1_.ID cross join PERSON person2_ where cat1_.OWNER=person2_.ID and person2_.FIRSTNAME=?)
Ambiguous field name ID between table CAT and table ANIMAL.
Moreover, the "inner join" in first select clause seems to be unnecessary.
Hibernate 4.2.5.Final, Firebird, Tomcat 7, jdk 1.7, Windows 7