fixed bug use hql to run when a entity is deleted