java - update query on 2 tables which are mapped with many-to-many in hibernate? -
java - update query on 2 tables which are mapped with many-to-many in hibernate? -
i tried in different ways, not fixed query.
i have 2 tables merchantoffers & merchantstore both mapped many-to-many. need update total count of active offer in every merchantstore . queries tried
"update merchantstore ms set ms.offers_count= ( select count(mo.offer_id) merchantoffers mo bring together mo.stores ms mo.offer_status=1 )"
for getting next exception
caused by: java.sql.sqlexception: can't specify target table 'merchantstore' update in clause
when effort following:
"update merchantstore ms bring together ms.offers mo set ms.offers_count=count(*) mo.offer_status=1)"
i error message:
org.hibernate.hql.ast.querysyntaxexception: expecting "set", found 'join'
in way failed write query.could 1 help.
thanks in advance,
raju.
java mysql hibernate
Comments
Post a Comment