Brett Meyer commented on Bug HHH-8318

Steve Ebersole, if I change the query to:

"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 member of aset.attrvalues)"

this results:

Caused by: org.h2.jdbc.JdbcSQLException: Ambiguous column name "ID"; SQL statement:
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 (id in (
                select attrvalues5_.attrvalues_id from ATTRSET_X_ATTRVALUE attrvalues5_
                where
                    Attrset.id=attrvalues5_.Attrset_id)))

1.) Attrset.id is still used, instead of the attrset3_ alias
2.) The root select element "id" is ambiguous (due to the alias being removed in the from element)
3.) Unless I'm mistaken, the attrvalue4_ alias should be used within the "and (id in (" select.

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