title: How ignore duplicate rows when insert
body: <p>I use <code>hibernate-jpa-2.1-api</code>. And I need some functionality. </p>
  
  <p>I parse a file every minute and insert data into MSSQL DB. I need to skip duplicate rows. For example at <code>12:00</code> I've got in my file 300 rows. I parse every of them and insert 300 rows. After one minute (<code>12:01</code>) my file contains 500 rows. I parse it and I want to insert only the 200 new rows and not the old 300 rows.</p>
  
  <p>In the old realization of the program I used SQL insert and did not use ORM. </p>
  
  <p>Here is my old SQL query:</p>
  
  <pre><code>insert /*+ ignore_row_on_dupkey_index(avaya_cm_cdr, i_avaya_cm_cdr_nodub) */  into avaya_cm_cdr(acmcdr_id, cdrdate, cdrtime, secdur, condcode, attdconsole, codeused, outcrtid, codedial, dialednum, intrkcode, incrtid, callingnum, vdn, bcc, ppm, acctcode, authcode) values(seq_acmcdr_id.nextval, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
  </code></pre>
  
  <p>And here is my new insert with ORM:</p>
  
  <pre><code>em = Persistence.createEntityManagerFactory("COLIBRI").createEntityManager();
  public void insertAVAYAcmCDRs(List&lt;AvayaCmCdr&gt; cdrList) {
      em.getTransaction().begin();
      for (AvayaCmCdr aCdrList : cdrList) {
          em.persist(aCdrList);
      }
      em.getTransaction().commit();
  }
  </code></pre>
  
  <p>How can I use the analog to the function <code>ignore_row_on_dupkey_index</code> with ORM?</p>
  
  <p>p.s. In the old realization I've used an Oracle DB.</p>