sql 报错:Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegri

原文链接:这里

0.报错详情
insert语句插入的时候报错。

报错详情如下:

org.springframework.dao.DuplicateKeyException: \r\n### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry ‘f098779b-3148-4bf5-b553-3274416dacd8-922a6ffe-142d-495d-b5d1-987’ for key ‘uni_company_binding_product’\r\n### The error may involve com.xxx.xxxx.buildingmaterials.dao.CompanyBindingProductMapper.insertCompanyBindingProduct-Inline\r\n### The error occurred while setting parameters\r\n### SQL: INSERT INTO company_binding_product(id, org_id, product_id, certificate_number, valid_time, attachment_url, type,classification) VALUES (?,?,?,?,?,?,?,?)\r\n### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry ‘f098779b-3148-4bf5-b553-3274416dacd8-922a6ffe-142d-495d-b5d1-987’ for key ‘uni_company_binding_product’\n; SQL []; Duplicate entry ‘f098779b-3148-4bf5-b553-3274416dacd8-922a6ffe-142d-495d-b5d1-987’ for key ‘uni_company_binding_product’; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry ‘f098779b-3148-4bf5-b553-3274416dacd8-922a6ffe-142d-495d-b5d1-987’ for key ‘uni_company_binding_product’"
主要原因是这个表设置了主键,主键唯一,而插入的数据重复了,所以会报这个错。

另外,不要忽略了还有联合主键这个,我的报错就是因为联合主键,id本身是UUID不会重复,但是和联合主键一块就出现了重复的情况,所以这个也要排查一下。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值