org.apache.ibatis.exceptions.PersistenceException:
Error updating database.
Cause: 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 ‘where id=8’ at line 1
The error may involve userMapper.update-Inline
The error occurred while setting parameters
SQL: update user set username=?, password=?, where id=?
Cause: 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 ‘where id=8’ at line 1
mybatis报错 结果发现自己真是蠢
我的UserMapper.xml文件
<update id="update" parameterType="org.example.domain.User">
update user set username=#{username}, password=#{password}, where id=#{id}
</update>
password=#{password} 后多了一个逗号,将逗号去掉就好了
一定要仔细检查自己的配置文件!!!!