Mybatis 报错 The error may involve cn.changemax.dao.FilmInfoDAO.batchUpdate-Inline

一、错误主题:

2020-02-07 22:37:43.596 ERROR 12612 --- [   scheduling-1] o.s.s.s.TaskUtils$LoggingErrorHandler    : Unexpected error occurred in scheduled task

org.springframework.jdbc.BadSqlGrammarException: 
### Error updating database.  Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UPDATE t_film_info
            SET modify_time = now()
            WHERE
       ' at line 6
### The error may involve cn.changemax.dao.FilmInfoDAO.batchUpdate-Inline
### The error occurred while setting parameters
### SQL: UPDATE t_film_info             SET modify_time = now()             WHERE             film_id = ?          ;              UPDATE t_film_info             SET modify_time = now()             WHERE             film_id = ?          ;              UPDATE t_film_info             SET modify_time = now()             WHERE             film_id = ?          ;              UPDATE t_film_info             SET modify_time = now()             WHERE             film_id = ?          t_film_info             SET modify_time = now()             WHERE             film_id = ?

 

二、笔者发现什么代码也没改,突然sql执行错误了。还报语法错误,关键我还把这个sql拿去数据库中执行了,反而执行成功了。

思虑再三发现:是在配置文件中关闭了一次执行多条sql的配置。

改为如下:

url: jdbc:mysql://127.0.0.1:3306/xxxxxxxxxxxx?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

核心在于参数:allowMultiQueries=true 

posted @ 2020-02-07 23:07  CHANGEMAX  阅读(1551)  评论(0编辑  收藏  举报