为什么update 方法,也会报 Duplicate entry '2222' for key 'PRIMARY'; nes
org.springframework.dao.DuplicateKeyException:
### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '201908291554169312352' for key 'PRIMARY'
### The error may involve com.rongan.rsdDataxSubjob.mapper.TRsdDataxSubjobMapper.updateTRsdDataxSubjob-Inline
### The error occurred while setting parameters
### SQL: update t_rsd_datax_subjob SET type = ?, priority = ?, create_time = ?, json_path = ?, name = ?, status = ?, id = ?, prejob_id = ?, nextjob_id = ?, filt_where = ?, orgjob_id = ?, min_time = ?, max_time = ?, remark = ?, update_time = ? where is_incret = ?
### Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '201908291554169312352' for key 'PRIMARY'
; Duplicate entry '201908291554169312352' for key 'PRIMARY'; nested exception is java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '201908291554169312352' for key 'PRIMARY'
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:242)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy92.update(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.update(SqlSessionTemplate.java:294)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy210.updateTRsdDataxSubjob(Unknown Source)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
不报错才怪,修改以数据表当中的主键为主
存在已经违法的主键,在数据库表中。
更新进去的值在其它行已经存在了就报这个错,正常啊
为什么不能报错,如果你id是主键的话,你的update里面更新了主键