dao.gethibernatesession().createquery(hql).setparameter("bookid", bookid).setparameter("batch", batch).executeupdate();
(1)string hql="delete from tbproduceplanaccount ppa where ppa.tbbusinessplanaccount.batch=:batch and ppa.tbproduceplanbook.id=:bookid ";
异常:
hibernate: delete from tb_produceplanaccount, tb_businessplanaccount tbbusiness1_ where batch=? and produceplanbook_id=?
2011-11-17 11:50:16,166 warn [jdbcexceptionreporter] sql error: 933, sqlstate: 42000
2011-11-17 11:50:16,166 error [jdbcexceptionreporter] ora-00933: sql 命令未正确结束
(2)hql="delete from tbproduceplanaccount ppa where ppa in (from tbproduceplanaccount ppa where ppa.tbbusinessplanaccount.batch=:batch and ppa.tbproduceplanbook.id=:bookid)";
总结: hibernate的理解方式与人不同,不能自动生成子查询;
更新或删除操作是不允许联表的,必须通过子查询找出数据.题外语:级联删除是要设置映射的.
posted on 2011-11-17 12:47
紫蝶∏飛揚↗ 阅读(1214)
评论(0) 编辑 收藏 所属分类:
hibernate