[英]Mysql updating user password
I am trying update password for database using mybatis: 我正在尝试使用mybatis更新数据库密码:
update person
set name = #{name},
address = #{address},
phoneNumber = #{phoneNumber},
balance = #{balance},
password = #{password},
id = #{new_id}
where id = #{id}
However, got following exception: 但是,出现以下异常:
org.apache.ibatis.exceptions.PersistenceException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'id' cannot be null
### The error may involve com.lsp.mybatis.PersonMapper.update-Inline
### The error occurred while setting parameters
### SQL: update person set name = ?, address = ?, phoneNumber = ? ,balance = ?, password = ?, id = ? where id = ?
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'id' cannot be null
I have specified the user id I want to update. 我已经指定了要更新的用户ID。 Why is it saying "id cannot be null"?
为什么说“ id不能为空”?
Can someone tell me what I did do wrong? 有人可以告诉我我做错了什么吗?
Remove in the query: id = #{new_id}
. 在查询中删除:
id = #{new_id}
。
So, the query will be: 因此,查询将是:
update person
set name = #{name},
address = #{address},
phoneNumber = #{phoneNumber},
balance = #{balance},
password = #{password}
where id = #{id}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.