简单解决 Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
简单解决 Error updating database.Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for
文章共674字 · 阅读需要大约3分钟
一键AI生成摘要,助你高效阅读
问答
·
问题描述
insert操作时莫名报错
org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'record ( oid,
number,
operator,
operator_describe ) VALUES ( 28,
'AS16986482811111' at line 1
### The error may exist in com/xxx/xxx/order/dao/OrderOperatingRecordDao.java (best guess)
### The error may involve com.xxx.xxx.order.dao.OrderOperatingRecordDao.insert-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO order_operating record ( oid, number, operator, operator_describe ) VALUES ( ?, ?, ?, ? )
### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'record ( oid,
拷贝报错信息里的SQL去数据库执行也是报错,说明是SQL语句有问题
### SQL: INSERT INTO order_operating record ( oid, number, operator, operator_describe ) VALUES ( ?, ?, ?, ? )
原因分析:
查找之后发现是
数据库表名
有问题。正确的表名应该是order_operating_record
。但是目前的表名是order_operating record
少了一个下划线_
解决方案:
1、将数据库表名修改正确
order_operating_record
2、将@TableName()
注解表名修改正确
更多推荐
已为社区贡献3条内容
所有评论(0)