Error Creating New Item as a Defect Type

Chris
Chris
  • Updated

Author: Chris Breaux

Date: February 27, 2024

Audience: Agents and Admins

Environmental details: Self-Hosted Native 8.79.4 (Many previous version upgrades since 2012)

Summary: 

Typically, when users create a new item type, they can have this item act as a 'default' item, a 'test case' or a 'defect.' Selecting one of these alters the behavior/default fields of the newly created item. In this case, the user attempted to create a 'defect-type' item but encountered an error pop-up in the UI referencing SQL errors.

Further inspection of the contour logs revealed the following errors:

2024-02-08 18:34:34,664 INFO http-nio-8080-exec-22 jama_staging [064e2a] [org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl] - HHH000010: On release of batch it still contained JDBC statements
2024-02-08 18:34:34,665 ERROR http-nio-8080-exec-22 jama_staging [064e2a] [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] - The UPDATE statement conflicted with the FOREIGN KEY constraint "FKA83F5AD5672FE4C8". The conflict occurred in database "Jama_Staging", table "dbo.documenttypecategory", column 'id'.

Solution:

  1. First, it should be noted that the documenttypecategoryIs not present in modern versions of jama. It existed before we implemented Liquibase to manage schema updates. I don't know precisely when this table was dropped, but it was from older tickets, possibly around 2014.
  2. Based on the error, we need to find where the FK constraint exists:
    SELECT *
    FROM
    INFORMATION_SCHEMA.KEY_COLUMN_USAGE
    WHERE CONSTRAINT_NAME = 'FKA83F5AD5672FE4C8'
  3. It was determined that this FK constraint existed on the documenttype table.
  4. Remove this constraint:
    MSSQL: ALTER TABLE documenttype DROP CONSTRAINT 'FKA83F5AD5672FE4C8';
    MySQL: ALTER TABLE documenttype DROP FOREIGN KEY 'FKA83F5AD5672FE4C8';
  5. Next, drop the (no longer needed) documenttypecategory table.
    DROP TABLE documenttypecategory;
  6. Users should be able to create new 'defect-type' items after performing these operations.

Cause:

The customer had been with jama since 2012 and upgraded many times. They encountered FK constraints related to tables no longer in use but had been present before Liquibase managed schema changes.

 

Feedback: Please leave feedback in the comments below.

 

Related to

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.