mysql

MyBatis 批量 update,字段不能为 null

MyBatis Batch Update Exception: Column cannot be null

https://stackoverflow.com/questions/32217568/mybatis-batch-update-exceptioncolumn-cannot-be-null

加一句 else

为什么加

UPDATE base\_goods\_package WHEN goodsId = #{item.goodsId} THEN #{item.packageRate} WHEN goodsId = #{item.goodsId} THEN #{item.packageName} WHEN goodsId = #{item.goodsId} THEN #{item.boxLong} WHEN goodsId = #{item.goodsId} THEN #{item.boxWidth} WHEN goodsId = #{item.goodsId} THEN #{item.boxHeight} WHEN goodsId = #{item.goodsId} THEN #{item.boxWeight} WHERE goodsId = #{item.goodsId}

我错了:
参数类型为非字符串类型的时候
上面像我这样写,假如costPrice是Integer,就完蛋了。
要么 item.costPrice.toString(),要么直接删掉写成
这样。

笔记

[ERROR] The user specified as a definer ('root'@'%') does not exist

2019-05-21 08:25:18,846 [org.hibernate.util.JDBCExceptionReporter]-[ERROR] The user specified as a definer (‘root’@’%’) does not exist
2019-05-21 08:25:18,846 [WARN]-[WARN] Resolved exception caused by Handler execution: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query

*That error may happen when you try to run some SQL commands as a ROOT user which was imported from another MySQL database

http://bitexperts.com/Question/Detail/3288/error-the-user-specified-as-a-definer-root-does-not-exist

-- Remove current user
DROP USER ‘root’@’%’;
-- Add ROOT user again
CREATE USER ‘root’@’%’ IDENTIFIED BY ‘ROOT_PASSWORD’;
-- Add permissions
GRANT ALL PRIVILEGES ON * . * TO ‘root’@’%’;
FLUSH PRIVILEGES;

那么多中文文章没有告诉我前两行的。。

笔记