com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'PRIMARY'

Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Solutions on the web

via journaldev.com by Unknown author, 1 year ago
via journaldev.com by Unknown author, 1 year ago
via Stack Overflow by Faron
, 2 years ago
Cannot add or update a child row: a foreign key constraint fails (`ecdl`.`computers`, CONSTRAINT `computers_ibfk_1` FOREIGN KEY (`pc_key`) REFERENCES `pc_keys` (`pc_key`))
via Stack Overflow by Vinze
, 2 years ago
Cannot add or update a child row: a foreign key constraint fails (`xxx/Semspace`, CONSTRAINT `FK4D6019AB6556109` FOREIGN KEY (`idCorpus`) REFERENCES `Corpus` (`idCorpus`))
via Google Groups by gbattine, 2 months ago
Cannot delete or update a parent row: a foreign key constraint fails (`microarray/esperimento`, CONSTRAINT `FK_RELATIONSHIP_19` FOREIGN KEY (`NOMELABORATORIO`) REFERENCES `laboratorio` (`NOMELABORATORIO`))
via Oracle Community by 653189, 1 year ago
Cannot add or update a child row: a foreign key constraint fails (`WEBLOGIC/CMV_NODE_VERSI ON_PROPERTY`, CONSTRAINT `FK1_CMV_ND_VER_PRP` FOREIGN KEY (`NODE_ID`, `NODE_VERS ION_ID`) REFERENCES `cmv_node_version` (`NODE_ID`, `NODE_VERSION_ID`))
com.mysql.jdbc.exceptions.MySQLIntegrityConstraintViolationException: Duplicate entry '1' for key 'PRIMARY'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:931)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1623)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1715)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3249)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1268)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1541)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1455)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1440)
at com.journaldev.jdbc.transaction.EmployeeJDBCInsertExample.insertEmployeeData(EmployeeJDBCInsertExample.java:57)
at com.journaldev.jdbc.transaction.EmployeeJDBCInsertExample.main(EmployeeJDBCInsertExample.java:21)

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 2 years ago
Samebug visitor profile picture
Unknown user
Once, 2 years ago

Know the solutions? Share your knowledge to help other developers to debug faster.