断点

每天进步一点点!
posts - 174, comments - 56, trackbacks - 0, articles - 21

Caused by: org.hibernate.NonUniqueObjectException

Posted on 2010-01-13 23:33 断点 阅读(1343) 评论(0)  编辑  收藏 所属分类: Hibernate

在做项目中碰见这样的问题,如下:
Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.pcis.cus.vo.CusClientVO#002255207];

原因: 有一个具有相同值的不同对象已经与和 session 相关联

解决(程序的一部分):
 //CusClientVO cusVo = new CusClientVO();
        CusClientVO cusVo = null;
        IUserDetails user = CurrentUser.getUser();
        try {
            if ("Same".equals(cusFlag)) {//被保险人和投保人是同一人
                cusVo = (CusClientVO)this.getById(CusClientVO.class, applicant.getCAppCde());
                if(cusVo==null){  //表示新增客户。
                    cusVo = new CusClientVO();
                }
                this.saveCusApplicant(applicant, cusVo);
                if(!applicantflag ){
                    cusVo.setTCrtTm(new Date());
                    cusVo.setCCrtCde(user.getOpRelCde());
                }
            }
            cusVo.setTUpdTm(new Date());
            cusVo.setCUpdCde(user.getOpRelCde());
            //
            this.saveOrUpdate(cusVo);
        } catch (DaoException ex) {
            BusinessServiceException e = new BusinessServiceException(ex);
            e.setErrorMsg("保存客户信息失败");
        }

相关连接:

http://hi.baidu.com/anypcao/blog/item/0db1a41cd3478d8187d6b6d2.html

http://agreal.javaeye.com/blog/339560


posted @ 2009-10-31 13:11 断点 阅读(61) | 评论 (0) 

只有注册用户登录后才能发表评论。


网站导航: