The following is only content for XML file in MyBatis <insert id="insertOrUpdateMultipleRecords" parameterType="HashMap"> INSERT INTO table1 ( field1, field2, created ) VALUES <foreach collection="inputList" item="inputListItem" separator=","> (#{inputListItem.itemfield1}, #{inputListItem.itemfield2} , NOW()) </foreach> ON DUPLICATE KEY UPDATE field2 = VALUES(field2) </insert>