I try to batch insert records and write back id into object. But I found that not all id can be write back (In my test, I insert two records but only one id was written back).
Here is my sql:
```
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO month (month, game_id)
VALUES
<foreach collection="list" item="f" separator=",">
(#{f.month}, #{f.gameId})
</foreach>
ON DUPLICATE KEY UPDATE
game_id = VALUES(game_id)
</insert>
```
Then when I delete the `ON DUPLICATE KEY UPDATE`, it was normal(all id can write back), new SQL:
```
<insert id="batchInsert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO month (month, game_id)
VALUES
<foreach collection="list" item="f" separator=",">
(#{f.month}, #{f.gameId})
</foreach>
ON DUPLICATE KEY UPDATE
game_id = VALUES(game_id)
</insert>
```