Getting error while updating the Table.

Certified Associate Developer

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 Children
  • 0
    A Score Level 1
    in reply to diptis2174

    It is acually hibernate stuff, SaveOrUpdate() method which actually executes in the background when Write to Data Store smart servie runs. If there is a CDT row that does not have id value then it actually creates one (based on the id creation algoritham that you are using for instance database sequence). If the CDT row already has primary key value then it will just update the data for that primary key.