Report.entity { @ManyToMany @JoinTable(name = "reports_contents_relations", joinColumns = @JoinColumn(name = "report_id"), inverseJoinColumns = @JoinColumn(name = "content_id")) @IndexColumn(name="content_order") private List contents = new ArrayList(); } Someclass { public void remoteContentFromReport(Content content) { List contents = report.getContents(); contents.remove(content); save(report); } }
When calling remoteContentFromReport method I get the following error.
java.sql.BatchUpdateException: Duplicate entry deleting from collection
I don't want to delete the Content.entity, just the entry in the join table associating it to a report.
What am I missing?