When I am trying to insert the data into the table I am getting this below error.
org.springframework.dao.DataIntegrityViolationException: Could not execute JDBC batch update; SQL [insert into messages(createdById, createdDate, lastAccessDate, lastUpdatedById, lastUpdatedDate, version, academicYearId, custId, message, desc , userId, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)]; constraint [null]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update.
Caused by: java.sql.BatchUpdateException: Duplicate entry '17431' for key 'PRIMARY'
I am using hibernate to save the entity.
The parent table is "Messages" and it has child classes and the mapping is like below.
@OneToMany(fetch=FetchType.EAGER,cascade={CascadeType.ALL}) @JoinColumn(name="messageId") public Set<MessageDetailsTracking> getMessageDetailsTracking() { return messageDetailsTracking;
public Object save(Object messages) { return dao.saveObject(messages); } Please help me to solve this issue
|