title: Jooq - Ignore Duplicates
body: <p>I'm currently using Jooq for a project, but I need a way to ignore duplicate keys on insert.</p>
  
  <p>I've got an array of objects I want to write into a table but if they already exist determined by a composite unique index on START_TS and EVENT_TYPE I want the insert to silently fail. </p>
  
  <p>My Code looks something like this:</p>
  
  <pre><code>InsertValuesStep&lt;MyRecord&gt; query = fac.insertInto(MY_REC,
                  MY_REC.START_TS,
                  MY_REC.STOP_TS,
                  MY_REC.EVENT_DATA,
                  MY_REC.EVENT_TYPE,
                  MY_REC.PUBLISHED_TS,
                  MY_REC.MY_ID
                  );
  
          for(int i=0;i&lt;recs.length;i++)
          {
              MyClass evt = recs[i]; 
              query.values(
                      new java.sql.Date(evt.startTS.getTime()),
                      (evt.stopTS == null) ? null : new java.sql.Date(evt.stopTS.getTime()),
                      evt.eventData,
                      evt.type.name(),
                      date,
                      id)
  
          }
  
          query.execute();
  </code></pre>
  
  <p>A solution like this would be ideal: <a href="https://stackoverflow.com/a/4920619/416338">https://stackoverflow.com/a/4920619/416338</a></p>
  
  <p>I figure I need to add something like:</p>
  
  <pre><code>.onDuplicateKeyUpdate().set(MY_REC.EVENT_TYPE,MY_REC.EVENT_TYPE);
  </code></pre>
  
  <p>But whatever I add it still seems to throw an error on duplicates. </p>