org.hibernate.exception.ConstraintViolationException: could not insert: [Testtable]

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 Hibernate JIRA by AndyW, 1 year ago
could not insert: [Testtable]
via Hibernate JIRA by AndyW, 1 year ago
could not insert: [Testtable]
via roller-user by Anil Gangolli, 6 months ago
could not insert: [org.roller.pojos.RollerPropertyData]
via roller-user by Bert Heymans, 6 months ago
could not insert: [org.roller.pojos.RollerPropertyData]
via roller-user by Anil Gangolli, 6 months ago
could not insert: [org.roller.pojos.RollerPropertyData]
via roller-user by Bert Heymans, 1 year ago
could not insert: [org.roller.pojos.RollerPropertyData]
java.sql.SQLException: Duplicate key or integrity constraint violation message from server: "Duplicate entry '2' for key 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2001)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1168)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1279)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2281)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1825)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1667)
at org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1846)
at org.hibernate.persister.entity.BasicEntityPersister.updateOrInsert(BasicEntityPersister.java:1906)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:75)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:726)
at undefined.HibernateTest.main(HibernateTest.java:38)

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, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago

Write tip

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