Getting error while updating the Table.

We are inserting into a table which is working fine. But later on in the same process mdoel we are updating the same row which we inserted. It is throwing error:

Details: org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update: java.sql.BatchUpdateException: Duplicate entry '15' for key 'PRIMARY': com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '15' for key 'PRIMARY' Data: 

 

Our cdt has foreign key mapping as well. The primary key is auto generated.

 

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    A Score Level 1
    in reply to chandhinir
    Hi All,

    Thanks for ur inputs. The issue is resolved. Actually, there exists an History table for my main table. By mistake someone has marked the Id as primary key in history table. There were triggers which update history table when insertion or updation is done in my main table. So , the issue was due to Primary key constraint in history table.
    The error which I was getting was not clear.. as in which table insertion is not possible.

    Thanks
Children
No Data