Transaction txn = Transaction.currentTxn();
try {
txn.start();
String sql = "INSERT INTO keystore (`name`, `certificate`, `key`, `domain_suffix`) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE `certificate`=?, `key`=?, `domain_suffix`=?";
PreparedStatement pstmt = txn.prepareAutoCloseStatement(sql);
pstmt.setString(1, name);
pstmt.setString(2, certificate);
pstmt.setString(3, key);
pstmt.setString(4, domainSuffix);
pstmt.setString(5, certificate);