I have a problem creating HQL that updates entity CommitteeMembership with nested queries or using joins, i tried this query first:
update CommitteeMemberShip cms set cms.isDeleted=1
where cms.committeeCycle.committee.id=:committeeId
but the generated SQL was wrong as following:
update CommitteeMemberShip cross join set isDeleted=1 where committee_id=?
without any this after "cross join" makes Hibernate throws SQLGrammarException
After that, i have changed my query to use sub-query:
update CommitteeMemberShip cms set cms.isDeleted=1
where cms.id in (select cmsIn.id from CommitteeMemberShip cmsIn inner join
cmsIn.committeeCycle cc inner join cc.committee c where c.id=:committeeId)
now Hibernate throws
java.sql.SQLException: You can't specify target table 'CommitteeMemberShip' for
update in FROM clause
any one have any idea how i can write this update query in HQL??