Skip to main content
manjit.1486
September 17, 2024
Question

Duplicate Entry / process run twice

  • September 17, 2024
  • 18 replies
  • 0 views

Hello Folks,

I got this below error in my process. I am not updating anything in the process. Please assist

An error occurred while trying to write to the entity "EMP_CASE " [id=916ee3cb-938e-4931-a61b-ba630fe5a543@61527, type=EMP_CASE (id=5350)] (data store: EMP Main DS). Details: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute statement: org.hibernate.exception.ConstraintViolationException: could not execute statement: java.sql.SQLIntegrityConstraintViolationException: (conn=7948467) Duplicate entry '229' for key 'EmpID': org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: Duplicate entry '229' for key 'EmpID': java.sql.SQLException: Duplicate entry '229' for key 'EmpID' Data: TypedValue[it=5351,v={{<null>,229,eFront,89777,<null>,<null>,Open,0,TEST,Case,1,1,0,,1.0,56777,<null>,<null>,,,<null>,,<null>,,<null>,,<null>,,<null>,2024-09-16 17:43:20.39}}]

18 replies

September 17, 2024

Could you check and confirm if your DB has value already stored for EmpID: 229.

This happens when you have used auto increment in Appian and Database Sequence has already passed that value or contains some value for given sequence.

manjit.1486
September 17, 2024

Yes, DB already has record against 229.

September 17, 2024

Verify if the last record in DB and the Sequence is same or not. If not you will keep on getting this error.

You can google to set the index in DB.

somasundaram.d
September 17, 2024

Did you try checking the logs for more information?

September 17, 2024

Hi Manjit,

I believe 'EmpID' is a foreign key in the 'EMP_CASE' table. If that's the case, could you verify whether a 'UNIQUE' key constraint has been added to this column? Since this is a one-to-many relationship, where multiple cases can be raised for an employee, the unique key constraint is not required and can be removed if it has been added

manjit.1486
September 17, 2024

EmpID is unique key in this table. 
ID is autoincremented. It is unique also.

September 17, 2024

May I ask why the 'EmpID' is configured as a unique key column in the Employee case table?

Since it is a unique key, it will prevent the insertion of case details with the same employee ID multiple times, meaning multiple cases cannot be created for or by the same employee. If the relationship is intended to be one-to-one, this makes sense. Otherwise, I would suggest removing the unique key constraint from the 'EmpID' column in the Employee case table.