mysql - Hibernate delete with joins without using IN -
i have following query works slow because using in:
_session.createquery(@" delete orderitem oi oi in (select orderitem i.product.id = :productid , i.order.company.id = :companyid , i.order.campaign.id :campaignid , i.order.orderstatus = :orderstatus) ") .setparameter("productid", productid) .setparameter("companyid", companyid) .setparameter("campaignid", campaignid) .setparameter("orderstatus", orderstatus) .executeupdate();
is there way use native query can use joins deletion like:
delete posts posts inner join projects on projects.project_id = posts.project_id projects.client_id = :client_id
yes. use session.createsqlquery()
, can use plain sql.
Comments
Post a Comment