废话不多说
程序架构 hibernate+spring代码  public int updateUserStatus(String status, String username, HttpServletRequest request) {
TjfAdminUser adminUser=(TjfAdminUser)request.getSession().getAttribute(SessionKey.adminUserKey);
String admin=adminUser.getEuserName();
int state=1;
String userState="";
try{
TjfRegister tjfRegister=(TjfRegister)userDao.getObject(TjfRegister.class, username);
tjfRegister.setEstatus(status);
TjfRegister tjfRegister1=(TjfRegister)userDao.saveOrUpdate(tjfRegister,Constant.UPDATE);

userState=(String)Constant.UserStatusMap.get(status);

return 1;
}catch(Exception e){
state=0;
return -1;
}finally{
saveAdminOperatorLog(admin,"修改用户"+username+"状态为"+userState,request.getRemoteHost(),state);
}
}

public boolean saveAdminOperatorLog(String adminName, String operatorMemo,String ip, int status){
try{
TjfAdminOperator tjfAdminOperator=new TjfAdminOperator();
tjfAdminOperator.setEoperatorMemo(operatorMemo);
tjfAdminOperator.setEstatus(status);
tjfAdminOperator.setEoperatorTime(new Date());
tjfAdminOperator.setEip(ip);

TjfAdminUser tjfAdminUser=(TjfAdminUser)userDao.getObject(TjfAdminUser.class, adminName);
tjfAdminOperator.setTjfAdminUser(tjfAdminUser);

userDao.saveOrUpdate(tjfAdminUser, Constant.SAVE);
return true;
}catch(Exception e){
logger.error("记录日志失败"+e.toString());
return false;
}
} public Object saveOrUpdate(Object obj, int type) {
if(type==Constant.SAVE)
this.getSession().clear();

getHibernateTemplate().saveOrUpdate(obj);
this.getSession().flush();
return obj;
}
页面上 ajax调用 updateUserStatus 方法 最后 在 userDao.saveOrUpdate(tjfAdminUser, Constant.SAVE);
这句报错 错误信息 为 org.hibernate.HibernateException: Found two representations of same collection: com.tjf.bean.TjfAdminUser.tjfAdminOperators求解 将 this.getSession().clear(); 去掉 后 不会 报错 但是 数据没有被插入 请不吝赐教