Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as3'

执行更新时的出错信息

Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Fri Jun 29 15:02:45 CST 2018
There was an unexpected error (type=Internal Server Error, status=500).
### Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as4' ### The error may involve com.nenu.dao.EmployeeDao.Employee ### The error occurred while setting parameters ### SQL: update employee set emp_name = ? and emp_password = ? where id=? ### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as4' ; ]; Data truncation: Truncated incorrect DOUBLE value: 'as4'; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as4'

更新代码

<update id="updateEmployee" parameterMap="Employee">
update
employee
set
emp_name = #{emp_name}
and emp_password = #{emp_password}
where
id=#{id}
</update>

错误原因及更正方法

update 更新时,连接两个变量的不是and ,而是 ,

更正代码

<update id="updateEmployee" parameterMap="Employee">
update
employee
set
emp_name = #{emp_name} ,emp_password = #{emp_password}
where
id=#{id}
</update>

编译通过

上一篇:SQLServer:删除log文件和清空日志的方法


下一篇:LINUX系统VMSTAT命令详解