title: Java PreparedStatement Syntax
body: <p>Is this the correct syntax for a prepared statement in java:</p>
  
  <pre><code>INSERT INTO table (id, version, data)
    VALUES (?, ?, ?)
    ON DUPLICATE KEY UPDATE 
      data = IF(version &gt; values(version), data, values(data)),
      version = IF(version &gt; values(version), version, values(version))
  </code></pre>
  
  <p>I am looking for the best way to insert or update millions of rows from within a for-loop in java taking advantage of PreparedStatement's addBatch.</p>