mybatis 使用时 报错集锦

原sql

<update id="update" parameterType = "java.util.List">
		<foreach collection="list" item="item" index="index" separator=";">
			update xxx set state = 1  where id= #{item.id}  and type = #{item.type} 
		</foreach> 
	</update>
错误1:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'update xxx set state = 1  where id = 60 ' at line 5

以上错误原因:separator=";"属性需要加上,因为两个sql语句之间间隔需要用分号,不需要open close 属性,加了也是报错

错误2:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderException: An invalid property 'JdbcType' was found in mapping #{__frch_item_0.type,JdbcType=BIGINT}.  Valid properties are javaType,jdbcType,mode,numericScale,resultMap,typeHandler,jdbcTypeName

以上错误原因:JdbcType 应该是jdbcType


版权声明:本文为qq_43193942原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。