MySQLIntegrityConstraintViolationException: Duplicate entry


严重: Servlet.service() for servlet [springmvc] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.DuplicateKeyException: ### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'admin-2' for key 'idx_unq_usercode_usertype' ### The error may involve com.lk.dao.UpDao.add-Inline ### The error occurred while setting parameters ### SQL: insert into lk_up(CU_ID,usercode,pwd,lock_status,T_ID,OG_ID,user_TYPE) values(?,?,?,?,?,?,?) ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'admin-2' for key 'idx_unq_usercode_usertype' ; SQL []; Duplicate entry 'admin-2' for key 'idx_unq_usercode_usertype'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'admin-2' for key 'idx_unq_usercode_usertype'] with root cause com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry 'admin-2' for key 'idx_unq_usercode_usertype' 插入数据报错,原因是 Duplicate entry 'admin-2' for key 'idx_unq_usercode_usertype' ,其中idx_unq_usercode_usertype是表的索引,且类型为unique索引,所以当为建立了索引的列赋相同的值进引发该错误。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM