Error updating database. Cause: java.sql.SQLException: ORA-00001: 违反唯一约束条件



org.springframework.dao.DuplicateKeyException:
### Error updating database.  Cause: java.sql.SQLException: ORA-00001: 违反唯一约束条件 (TANY_DEP.SYS_C00596888)

### The error may involve com.forlink.tany.entity.dao.TabSalMarketOrderMapper.updateByExampleSelective-Inline
### The error occurred while setting parameters
### SQL: update TAB_SAL_MARKET_ORDER      SET DETAIL_ID = ?,                                                                                                           TOTAL_QUANTITY = ?,                                     CHECK_TOTAL_QUANTITY = ?,                       SEND_TOTAL_QUANTITY = ?,                       RESV_TOTAL_QUANTITY = ?,                       SALE_TOTAL_QUANTITY = ?,                       TOTAL_AMOUNT = ?,                       TOTAL_DISCOUNT = ?,                       DISCOUNT_AMOUT = ?,                                                                 RETURN_STATUS = ?,                                            NUM1 = ?,                       NUM2 = ?,                                                   DOMAIN_NO = ?                          WHERE (  DETAIL_ID = ? )
### Cause: java.sql.SQLException: ORA-00001: 违反唯一约束条件 (TANY_DEP.SYS_C00596888)


解决办法:TabSalMarketOrderDetail model = new TabSalMarketOrderDetail();
      TabSalMarketOrderDetailExample example = new TabSalMarketOrderDetailExample();
      TabSalMarketOrderDetailExample.Criteria criteria = example.createCriteria();

Long returnQuantity = (long) Integer.parseInt(map.get("returnQuantity").toString());
      Long discountPrice = (long) Integer.parseInt(map.get("discountPrice").toString());
      String remarks = map.get("remarks").toString();

model.setReturnQuantity(returnQuantity);

model.setDiscountPrice(discountPrice);

model.setRemarks(remarks);

model.setDetailId(detailId);****主键设置是必须***

criteria.andDetailIdEqualTo(detailId);
      tabSalMarketOrderDetailMapper.updateByPrimaryKeySelective(model);

  • 0
    点赞
  • 2
    评论
  • 0
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值