1
我使用的MyBatis試圖更新密碼數據庫:Mysql的更新用戶密碼
update person
set name = #{name},
address = #{address},
phoneNumber = #{phoneNumber},
balance = #{balance},
password = #{password},
id = #{new_id}
where id = #{id}
但是,有以下情況除外:
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
我已指定用戶ID我想更新。爲什麼說「ID不能爲空」?
有人能告訴我我做錯了什麼嗎?
是否要更新'ID'或'password'? – Smit