Description of problem: The fix for HHH-5209 exposed (possibly caused, but not sure) a new issue with a "delete" query using a "member of". The commit in question: https://github.com/hibernate/hibernate-orm/commit/95bc0194ec37738572c6b8202f1312f82622d747 Query, generated SQL before the commit, and generated SQL after the commit: https://gist.github.com/brmeyer/8434aee0de36e0639d0f The failure is caused by the "Attrset.id=attrvalues5_.Attrset_id" in the last "where". It should be using the "attrset3_" alias. Version-Release number of selected component (if applicable): Hibernate core 4.2.0, but issue was introduced in 4.1.8 How reproducible: Always Steps to Reproduce: EntityManager em = getOrCreateEntityManager(); em.getTransaction().begin(); em.createQuery( "delete Attrvalue aval where aval.id in ( " + "select val2.id from Employee e, Employeegroup eg, Attrset aset, Attrvalue val2 " + "where eg.id = e.employeegroup.id " + "and aset.id = e.attrset.id " + "and val2.id member of aset.attrvalues)").executeUpdate(); em.getTransaction().commit(); Actual results: delete from Attrvalue where id in ( select attrvalue4_.id from Employee employee1_ cross join Employeegroup employeegr2_ cross join Attrset attrset3_ cross join Attrvalue attrvalue4_ where employeegr2_.id=employee1_.employeegroup_id and attrset3_.id=employee1_.attrset_id and ( attrvalue4_.id in ( select attrvalues5_.attrvalues_id from ATTRSET_X_ATTRVALUE attrvalues5_ where Attrset.id=attrvalues5_.Attrset_id ) ) ) Expected results: delete from Attrvalue where id in ( select attrvalue4_.id from Employee employee1_ cross join Employeegroup employeegr2_ cross join Attrset attrset3_ cross join Attrvalue attrvalue4_ where employeegr2_.id=employee1_.employeegroup_id and attrset3_.id=employee1_.attrset_id and ( attrvalue4_.id in ( select attrvalue6_.id from ATTRSET_X_ATTRVALUE attrvalues5_, Attrvalue attrvalue6_ where attrset3_.id=attrvalues5_.Attrset_id and attrvalues5_.attrvalues_id=attrvalue6_.id ) ) ) Additional info:
Pushed to http://git.app.eng.bos.redhat.com/?p=hibernate/hibernate-core.git;a=shortlog;h=refs/heads/eap61-cp-updates
There was one-off patch for EAP 6.1.0 [1] to fix this issue. It must be included into EAP 6.1.1 to have all one-offs covered Reseting jboss-eap-6.1.1 flag to '?' to evaluate it again. [1] https://bugzilla.redhat.com/show_bug.cgi?id=977522#c9
EAP 6.2.0.ER1