mybatis批量更新的时候报错语法错误
错误:
本案例使⽤的批量更新⽅式:
<update id="updateQuestionXuekubaoBatch" parameterType="bbk.vertor.pojo.QuestionXuekubaoPojo" keyProperty="id" useG <foreach collection="list" index="index" item="item" open="" separator=";" close="">
update t_question_xuekebao_linux
<set>
content = #{t},
answer = #{item.answer},
solution = #{item.solution},
course = #{urse},
grade = #{ade},
content_exist_flag = #{tExistFlag},
answer_exist_flag = #{item.answerExistFlag},
content_exist_flag = #{tExistFlag},
parse_exist_flag= #{item.parseExistFlag},
qiniu_flag= #{item.qiniuFlag},
paper_flag= #{item.paperFlag},
pic_exist_flag = #{item.picExistflag},
update_time = #{ateTime}
</set>
WHERE id_old = #{item.idOld}
</foreach>
</update>
⼤前提是要在数据源配置的地⽅加
详细参考如下:
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
destroy-method="close">
<property name="driverClassName" value="sql.jdbc.Driver" />
update语法大全<property name="url" value="jdbc:mysql://:8265/xuekubao?allowMultiQueries=true" /> <property name="username" value="content_library_test" />
<property name="password" value="con1te#st$@ary" />
<property name="maxActive" value="20"/>
<property name="initialSize" value="1"/>
<property name="minIdle" value="1"/>
<property name="maxWait" value="60000"/>
<property name="timeBetweenEvictionRunsMillis" value="60000"/>
<property name="minEvictableIdleTimeMillis" value="300000"/>
<property name="validationQuery" value="SELECT 1 FROM DUAL"/>
<property name="testWhileIdle" value="true"/>
<property name="testOnBorrow" value="false"/>
<property name="testOnReturn" value="false"/>
<property name="poolPreparedStatements" value="true"/>
<property name="maxOpenPreparedStatements" value="20"/>
<property name="proxyFilters">
<ref bean="wall-filter"/>
</property>
<property name="filters" value="stat,wall,log4j"/>
<property name="connectionProperties" value="Sql=true"/>
</bean>
<bean id="wall-filter" class="com.alibaba.druid.wall.WallFilter">
<property name="dbType" value="mysql"/>
<property name="config" ref="wall-config"/>
</bean>
<bean id="wall-config" class="com.alibaba.druid.wall.WallConfig">
<!-- 批量sql -->
<property name="multiStatementAllow" value="true"/>
</bean>
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论