org.hibernate.exception.ConstraintViolationException: could not delete: [de.fittransporte.fitdb.reference.Country#10]

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

Samebug tips

,

Check whether privilege has the "not null" restriction. If so it always has to have a value and can never be null.

A different reason could be a wrong implementation of a foreign key. Check whether you always correctly insert/update in both tables.

Solutions on the web

via Spring JIRA by Alexander Heusingfeld, 1 year ago
could not delete: [de.fittransporte.fitdb.reference.Country#10]
via Spring JIRA by Alexander Heusingfeld, 1 year ago
could not delete: [de.fittransporte.fitdb.reference.Country#10]
via com.br by Unknown author, 1 year ago
via Coderanch by Haifeng Jiang, 11 months ago
could not delete: [model.Room#2]
via GitHub by StevensBrian
, 2 years ago
could not delete: [org.archiviststoolkit.model.Resources#2]
org.hibernate.exception.ConstraintViolationException: could not delete: [de.fittransporte.fitdb.reference.Country#10]
at sun.reflect.GeneratedConstructorAccessor64.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1734)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2019)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1937)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1922)
at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2528)
at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:77)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:41)
at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:969)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1114)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at de.fittransporte.fitdb.reference.DefectCauser_Roo_Entity.ajc$interMethod$de_fittransporte_fitdb_reference_DefectCauser_Roo_Entity$de_fittransporte_fitdb_reference_DefectCauser$countDefectCausers(DefectCauser_Roo_Entity.aj:8)
at de.fittransporte.fitdb.reference.DefectCauser.countDefectCausers(DefectCauser.java:1)
at de.fittransporte.fitdb.reference.DefectCauser_Roo_Entity.ajc$interMethodDispatch1$de_fittransporte_fitdb_reference_DefectCauser_Roo_Entity$de_fittransporte_fitdb_reference_DefectCauser$countDefectCausers(DefectCauser_Roo_Entity.aj)
at de.fittransporte.fitdb.reference.DefectCauserIntegrationTest_Roo_IntegrationTest.ajc$interMethod$de_fittransporte_fitdb_reference_DefectCauserIntegrationTest_Roo_IntegrationTest$de_fittransporte_fitdb_reference_DefectCauserIntegrationTest$testFindDefectCauserEntries(DefectCauserIntegrationTest_Roo_IntegrationTest.aj:42)
at de.fittransporte.fitdb.reference.DefectCauserIntegrationTest.testFindDefectCauserEntries(DefectCauserIntegrationTest.java:1)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.springframework.test.context.junit4.statements.RunSpringTestContextAfters.evaluate(RunSpringTestContextAfters.java:82)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)

Users with the same issue

Samebug visitor profile picture
Unknown user
2 times, 1 year ago
Once, 1 year ago
2 times, 3 months ago
7 times, 5 months ago
Once, 1 day ago
69 more bugmates

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