I Have a next SQL Query:
const val INSERT_OR_UPDATE_ITEM_SQL = "" +
"INSERT INTO `items` (owner_id, object_id, item_id, count, enchant_level, item_location, item_location_data, custom_type1, custom_type2, duration_left, create_time)" +
"VALUES (?,?,?,?,?,?,?,?,?,?,?) " +
"ON DUPLICATE KEY UPDATE owner_id=?,object_id=?,item_id=?,count=?,enchant_level=?,item_location=?,item_location_data=?,custom_type1=?,custom_type2=?,duration_left=?,create_time=?"
And this is preparation of PreparedStatement:
statement.setString(1, item.ownerId)
statement.setInt(2, item.objectId)
statement.setInt(3, item.template.id)
statement.setInt(4, item.count)
statement.setInt(5, item.enchantLevel)
statement.setString(6, item.itemLocation.name)
statement.setInt(7, item.itemLocationData)
statement.setInt(8, item.customType1)
statement.setInt(9, item.customType2)
statement.setInt(10, item.durationLeft)
statement.setLong(11, item.createTime)
The issue here is when i try to execute query :
Exception in thread "main" java.sql.SQLTransientConnectionException: (conn=352) Parameter at position 12 is not set
This is because I have 22 Questions mark instead of 11 (because of ON CONFLICT UPDATE)
My Simple task is to make INSERT or UPDATE