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