Caused by: org.hibernate.NonUniqueObjectException

在做项目中碰见这样的问题,如下:
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

 

转载于:https://www.cnblogs.com/ztf2008/archive/2009/10/31/1593478.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值