解决a different object with the same identifier value was already associated with the session错
(2011-08-18 11:26:30)
标签:
杂谈 |
分类: Java区 |
如:更新一个信息。
如:把一个用户移出某个部门,根据部门的Id获取部门的信息,得到一个部门对象DepartmentInfo di,再Set
set=di.getUsers();遍历该set如下:
Iterator it=set.iterator();
思路:必须要从部门信息中获取用户的对象。
误区:不能new一个用户对象然后根据用户Id获取用户信息再赋给这个对象,这样的话就会产生a different object with the same identifier value was already associated with the session错误了!!!