MyBatis: getting id from inserted array of object returns error

前端 未结 2 2023
面向向阳花
面向向阳花 2021-01-03 08:10

I use mybatis 3.3.0-SNAPSHOT. I want to insert list of objects, and get id of every object. In interface I have:

public void createCore(@Param(\"cores\")List         


        
相关标签:
2条回答
  • 2021-01-03 08:31

    Got that error too while trying to insert multiple rows with usegeneratedkeys.

    The workaround fix I found was mentioned here:http://mybatis-user.963551.n3.nabble.com/MyBatys-Batch-Insert-doubt-error-retrieving-generated-id-binding-to-POJO-td4029977.html

    All you need is to rename the param to "list". so "cores" -> "list" in the example above, and auto generated ids are working.

    0 讨论(0)
  • 2021-01-03 08:39

    This is issue is fixed in version 3.3.1

    0 讨论(0)
提交回复
热议问题