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<Object> cores);
In xml mapper I have:
<insert id="createCore" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
INSERT INTO mytable (raz,dva,tri )
VALUES
<foreach collection="cores" item="core" separator=",">
(#{core.raz}, #{core.dva}, #{core.tri})
</foreach>
</insert>
And I get:
Error updating database. Cause: org.apache.ibatis.executor.ExecutorException: Error getting generated
key or setting result to parameter object. Cause: org.apache.ibatis.binding.BindingException: Parameter 'id' not found. Available parameters are [cores, param1]
I tried and keyProperty="core.id" but get the same error.
How to fix it?