故事
在使用xerial/sqlite-jdbc
版本是3.28.0时发现了这样的问题,由于mysql有update、delete的批量操作支持。但是sqlite3从语法上是不支持的。我们应该如何sqlite3的条件下使用多表批量操作,基本上能想到的方法就是执行一个xml方法中一次执行多条语句了。但是很不幸的告诉你,我们会遇到下面的问题。
xml多sql
<update id="update">
update user
set a = #{a}
where id = #{id};
update user2
set a = #{a}
where id = 3
</update>
这里同时更新两张表,分号分割。但分后好的#{a}
无法传入
Caused by: org.apache.ibatis.type.TypeException: Error setting non null for parameter #3 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.lang.ArrayIndexOutOfBoundsException: 2
at org.apache.ibatis.type.