自己用SQL语句写一下,不要调用hibernate的方法,举个例子:
1//this.getSession().delete(user);
2this.getSession().createQuery("delete from User where id=?").setParameter(0, id).executeUpdate();
把1句该为2句就对了
原因:不太清楚,可能是Hibernate优化的原因吧,那天有时间看看源码
我也遇到同样的问题,我是在删除,和更新后,session.fLush一下就OK了,但不知道为什么这样,因为我也配置了事务,正常事务提交,会执行delete方法的
在xml文件中添加dynamic-update="true"试试看。
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....