title: Hibernate @OneToMany mapping is giving exception,
body: <p>Can you help me what is wrong with this?</p>
  
  <pre><code>@Entity
  @Table(name = "vendor_po")
  public class VendorPO {
      @Id
      @Column(name = "vendor_po_id")
      @GeneratedValue(strategy = GenerationType.AUTO)
      private long vendor_po_id;
  
      @OneToMany(orphanRemoval = false, cascade = { CascadeType.DETACH, CascadeType.MERGE, 
      CascadeType.CascadeType.PERSIST, CascadeType.REFRESH })
      private List&lt;PaymentMethods&gt; payments = new ArrayList&lt;PaymentMethods&gt;();
  }
  </code></pre>
  
  <p>I am getting this exception.</p>
  
  <pre><code>java.sql.SQLIntegrityConstraintViolationException: Duplicate entry '2706' for key 'UK_8490nkhe03w8piq2nitrma5ok'
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117) ~[mysql-connector-java-8.0.18.jar:8.0.18]
      at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.18.jar:8.0.18]
      at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.18.jar:8.0.18]
  </code></pre>