摘要: 在项目中遇到这个 HibernateException: Illegal attempt to associate a collection with two open sessions. 一查代码发现是因为在service中存在两个不同的hibernate session都同时引用了同一个collection对象,一个是load(),一个是saveOrUpdate(),简单的修改方法: hibernate session 的 merge() 方法。hibernate3.0以上可以使用merge()来合并两个session中的同一对。将原来的代码:this.classificationDAO. 阅读全文
posted @ 2012-08-27 12:40 haycco 阅读(5976) 评论(0) 推荐(0) 编辑