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 ‘EXPLAIN, PHONE, ID) values (‘2019-08-13 13:54:04.651’, ‘2019-08-13 13:54:04.651’’ at line 1
[2019-08-13 13:54:12,370 INFO CommonsLogger.java:info:50] ---- Could not execute JDBC batch update; SQL [insert into anti_phone_fraud (CREATE_TIME, LAST_UPDATE, EXPLAIN, PHONE, ID) values (?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
org.springframework.dao.InvalidDataAccessResourceUsageException: Could not execute JDBC batch update; SQL [insert into anti_phone_fraud (CREATE_TIME, LAST_UPDATE, EXPLAIN, PHONE, ID) values (?, ?, ?, ?, ?)]; nested exception is org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:635)
at org.springframework.orm.hibernate3.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:794)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:665)
如何解决:首先查看数据库中定义字段是否是关键字,每一个都去查。我的是设置EXPLAIN字段为关键字,所以插入数据一直插不进去。如有同样异常,逐一排查字段即可。