org.hibernate.exception.ConstraintViolationException: could not execute statement

Hibernate JIRA | Martin Šimka | 3 years ago
  1. 0

    org.hibernate.test.annotations.entity.BasicHibernateAnnotationsTest ./gradlew hibernate-core:test -Dtest.single=entity/BasicHibernateAnnotationsTest --stacktrace fails on jdk8, passes on jdk7 {noformat} org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189) at org.hibernate.hql.internal.ast.exec.BasicExecutor.doExecute(BasicExecutor.java:108) at org.hibernate.hql.internal.ast.exec.BasicExecutor.execute(BasicExecutor.java:77) at org.hibernate.hql.internal.ast.exec.DeleteExecutor.execute(DeleteExecutor.java:124) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:415) at org.hibernate.engine.query.spi.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:321) at org.hibernate.internal.SessionImpl.executeUpdate(SessionImpl.java:1215) at org.hibernate.internal.QueryImpl.executeUpdate(QueryImpl.java:116) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.cleanupTestData(BaseCoreFunctionalTestCase.java:450) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.afterTest(BaseCoreFunctionalTestCase.java:425) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:36) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62) Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "FK_7CJ956HLMXNL32GWK7EKI7DG4: PUBLIC.NARRATIVE FOREIGN KEY(TOPIC_ID) REFERENCES PUBLIC.TOPIC(ID)"; SQL statement: delete from Topic [23003-145] at org.h2.message.DbException.getJdbcSQLException(DbException.java:327) at org.h2.message.DbException.get(DbException.java:167) at org.h2.message.DbException.get(DbException.java:144) at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:382) at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:399) at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:275) at org.h2.table.Table.fireConstraints(Table.java:803) at org.h2.table.Table.fireAfterRow(Table.java:820) at org.h2.command.dml.Delete.update(Delete.java:80) at org.h2.command.CommandContainer.update(CommandContainer.java:69) at org.h2.command.Command.executeUpdate(Command.java:201) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186) ... 18 more {noformat}

    Hibernate JIRA | 3 years ago | Martin Šimka
    org.hibernate.exception.ConstraintViolationException: could not execute statement
  2. 0

    org.hibernate.test.annotations.entity.BasicHibernateAnnotationsTest ./gradlew hibernate-core:test -Dtest.single=entity/BasicHibernateAnnotationsTest --stacktrace fails on jdk8, passes on jdk7 {noformat} org.hibernate.exception.ConstraintViolationException: could not execute statement at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189) at org.hibernate.hql.internal.ast.exec.BasicExecutor.doExecute(BasicExecutor.java:108) at org.hibernate.hql.internal.ast.exec.BasicExecutor.execute(BasicExecutor.java:77) at org.hibernate.hql.internal.ast.exec.DeleteExecutor.execute(DeleteExecutor.java:124) at org.hibernate.hql.internal.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:415) at org.hibernate.engine.query.spi.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:321) at org.hibernate.internal.SessionImpl.executeUpdate(SessionImpl.java:1215) at org.hibernate.internal.QueryImpl.executeUpdate(QueryImpl.java:116) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.cleanupTestData(BaseCoreFunctionalTestCase.java:450) at org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.afterTest(BaseCoreFunctionalTestCase.java:425) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:36) at org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62) Caused by: org.h2.jdbc.JdbcSQLException: Referential integrity constraint violation: "FK_7CJ956HLMXNL32GWK7EKI7DG4: PUBLIC.NARRATIVE FOREIGN KEY(TOPIC_ID) REFERENCES PUBLIC.TOPIC(ID)"; SQL statement: delete from Topic [23003-145] at org.h2.message.DbException.getJdbcSQLException(DbException.java:327) at org.h2.message.DbException.get(DbException.java:167) at org.h2.message.DbException.get(DbException.java:144) at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:382) at org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:399) at org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:275) at org.h2.table.Table.fireConstraints(Table.java:803) at org.h2.table.Table.fireAfterRow(Table.java:820) at org.h2.command.dml.Delete.update(Delete.java:80) at org.h2.command.CommandContainer.update(CommandContainer.java:69) at org.h2.command.Command.executeUpdate(Command.java:201) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186) ... 18 more {noformat}

    Hibernate JIRA | 3 years ago | Martin Šimka
    org.hibernate.exception.ConstraintViolationException: could not execute statement
  3. 0

    H2 "OTHER" data type throws Exception when storing String or Boolean

    Stack Overflow | 1 year ago | Steve McLeod
    org.h2.jdbc.JdbcSQLException: Hexadecimal string contains non-hex character: "foobar"; SQL statement: insert into test (key, value) values (?, ?) -- (?1, ?2) [90004-188]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Unable to generate an api-token on rundeck 1.5

    GitHub | 4 years ago | connaryscott
    org.h2.jdbc.JdbcSQLException: Value too long for column AUTH_ROLES VARCHAR(255) NOT NULL: 'GS-Members-MISMO-CORP,GS-EComm-WebAdmins,GS-WebSiteAccess-MIS-CORP,Web Admins-eCommerce,$MISMO,GS-PrivNAS-AK-CORP,GS-Everyone-M... (303); SQL statement: insert into auth_token (id, version, auth_roles, token, user_id) values (null, ?, ?, ?, ?) [90005-112]
  6. 0

    creating a job on the UI leads to "value too long for column USER_RULE_LIST..."

    GitHub | 3 years ago | connaryscott
    org.h2.jdbc.JdbcSQLException: Value too long for column USER_ROLE_LIST VARCHAR(255): 'SNC-Ecommerce Search,GS-Members-MISMO-CORP,$MISMO,GS-PrivNAS-AK-CORP,GS-APMQALDAP,GS-APMPRDLDAP,IT eCommerce Organization,SNC-E... (412); SQL statement: insert into scheduled_execution (id, version, adhoc_execution, adhoc_filepath, adhoc_local_string, adhoc_remote_string, arg_string, date_created, day_of_month, day_of_week, description, do_nodedispatch, exec_count, group_path, hour, job_name, last_updated, loglevel, minute, month, multiple_executions, next_execution, node_exclude, node_exclude_name, node_exclude_os_arch, node_exclude_os_family, node_exclude_os_name, node_exclude_os_version, node_exclude_precedence, node_exclude_tags, node_include, node_include_name, node_include_os_arch, node_include_os_family, node_include_os_name, node_include_os_version, node_include_tags, node_keepgoing, node_rank_attribute, node_rank_order_ascending, node_threadcount, project, scheduled, seconds, total_time, rduser, user_role_list, uuid, workflow_id, year) values (null, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) [90005-112]

  1. tvrmsmith 1 times, last 15 hours ago
  2. j.kienzle 2 times, last 1 month ago
  3. Shadd518 4 times, last 4 months ago
  4. MoYapro 1 times, last 4 months ago
11 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. org.h2.jdbc.JdbcSQLException

    Referential integrity constraint violation: "FK_7CJ956HLMXNL32GWK7EKI7DG4: PUBLIC.NARRATIVE FOREIGN KEY(TOPIC_ID) REFERENCES PUBLIC.TOPIC(ID)"; SQL statement: delete from Topic [23003-145]

    at org.h2.message.DbException.getJdbcSQLException()
  2. H2 Database Engine
    JdbcPreparedStatement.executeUpdate
    1. org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
    2. org.h2.message.DbException.get(DbException.java:167)
    3. org.h2.message.DbException.get(DbException.java:144)
    4. org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:382)
    5. org.h2.constraint.ConstraintReferential.checkRowRefTable(ConstraintReferential.java:399)
    6. org.h2.constraint.ConstraintReferential.checkRow(ConstraintReferential.java:275)
    7. org.h2.table.Table.fireConstraints(Table.java:803)
    8. org.h2.table.Table.fireAfterRow(Table.java:820)
    9. org.h2.command.dml.Delete.update(Delete.java:80)
    10. org.h2.command.CommandContainer.update(CommandContainer.java:69)
    11. org.h2.command.Command.executeUpdate(Command.java:201)
    12. org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:143)
    13. org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:129)
    13 frames
  3. Hibernate
    QueryImpl.executeUpdate
    1. org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)
    2. org.hibernate.hql.internal.ast.exec.BasicExecutor.doExecute(BasicExecutor.java:108)
    3. org.hibernate.hql.internal.ast.exec.BasicExecutor.execute(BasicExecutor.java:77)
    4. org.hibernate.hql.internal.ast.exec.DeleteExecutor.execute(DeleteExecutor.java:124)
    5. org.hibernate.hql.internal.ast.QueryTranslatorImpl.executeUpdate(QueryTranslatorImpl.java:415)
    6. org.hibernate.engine.query.spi.HQLQueryPlan.performExecuteUpdate(HQLQueryPlan.java:321)
    7. org.hibernate.internal.SessionImpl.executeUpdate(SessionImpl.java:1215)
    8. org.hibernate.internal.QueryImpl.executeUpdate(QueryImpl.java:116)
    8 frames
  4. A Hibernate O/RM Module
    BaseCoreFunctionalTestCase.afterTest
    1. org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.cleanupTestData(BaseCoreFunctionalTestCase.java:450)
    2. org.hibernate.testing.junit4.BaseCoreFunctionalTestCase.afterTest(BaseCoreFunctionalTestCase.java:425)
    2 frames
  5. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:483)
    4 frames
  6. JUnit
    FailOnTimeout$StatementThread.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
    4. org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:36)
    5. org.junit.internal.runners.statements.FailOnTimeout$StatementThread.run(FailOnTimeout.java:62)
    5 frames