您的位置:首页 > 移动开发 > Objective-C

a different object with the same identifier value was already associated with the session

2015-07-15 18:08 441 查看
解决a different object with the same identifier value was already associated with the session错误

这个错误产生原因在hibernate中同一个session里面有了两个相同标识,但是是不同实体,当这时运行saveOrUpdate(object)操作的时候就会报这个错误。

因为我在实体类的配置中实体之间的关联关系中使用了cascade=”save-update”导致我在新增数据的时候报了以上的错。

我的解决方法是将cascade=”save-update”改为cascade=”none”就可以了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: