Is this the correct syntax for a prepared statement in java:
INSERT INTO table (id, version, data)
VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE
data = IF(version > values(version), data, values(data)),
version = IF(version > values(version), version, values(version))
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.