不是可以同时update多次同一条数据的同样字段,因为可能第一个update还没执行成功,第二条就过来了,就会抛出异常,需要加个flag判断
例如
update log set status = ?, send_time = now(), updated_at = now() where id = ?
通知异常(String), 22985ba4299e4220b338d85b4c30f531(String)
update log set status = ?, send_time = now(), updated_at = now() where id = ?
通知异常(String), 22985ba4299e4220b338d85b4c30f531(String)
这样就会报这样的错
Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column ‘status’ at row 1
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: update mc_notify_log_main set status = ?, send_time = now(), updated_at = now() where id = ?
Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column ‘status’ at row 1
; Data truncation: Data too long for column ‘status’ at row 1; nested exception is com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column ‘status’ at row 1