Error updating database.

本文记录了一次由于配置文件中SQL语句语法错误导致的MyBatis报错问题。在尝试更新数据库时,出现了MySQLSyntaxErrorException,原因是update语句中多了一个逗号。通过检查UserMapper.xml文件并修正了多余的逗号,问题得以解决。提醒开发者在编写和配置SQL语句时务必仔细检查语法,避免类似错误。
摘要由CSDN通过智能技术生成

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} 后多了一个逗号,将逗号去掉就好了

一定要仔细检查自己的配置文件!!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值