I try to insert List
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.patentquery.dao.impl.MyDaoImpl">
<sql id="table_name">patentquery</sql>
<sql id="column_all">fan,xpn,ifpct,ti,ab,aarea,ifgd,parea,icm,cypt,tecd,tecdid1,tecdid2,tecdid3,effect,pd,apd,pay,py</sql>
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO <include refid="table_name"/>
(fan,xpn)
VALUES
<foreach collection="list" item="tag" separator="," index="index">
(
#{tag[0]},#{tag[1]}
)
</foreach>
</insert>
</mapper>
So, it's that mybatis unsupport the insert the type of List
I try to read the source code,and found that org.apache.ibatis.scripting.defaults.DefaultParameterHandler.class
is try to deal with this problem,but it seems that it didn't work in my computer.Can anybody help me?
@wudeyong Thanks you for your reporting!
Probably, a cause is here in the ForEachSqlNode. I will try to fix this issue.
We will consider fix in 3.4.6 or later because modification other than ForEachSqlNode is also necessary
Most helpful comment
@wudeyong Thanks you for your reporting!
Probably, a cause is here in the
ForEachSqlNode. I will try to fix this issue.