java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corres
阿里云国内75折 回扣 微信号:monov8 |
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6 |
前言
使用通用mapper插入对象报错,检查代码和映射类均无问题
; bad SQL grammar []; nested exception is 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 'order ( state,c_time,o_id,start_adress,end_adress,proposer,relevant_user,remark' at line 1] with root 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 'order ( state,c_time,o_id,start_adress,end_adress,proposer,relevant_user,remark' at line 1
排查
复制出SQL进入SQLyog测试,发现失败,这时候想到是关键字问题,使用引号括住关键字
SELECT * FROM `order`;
INSERT INTO `order` ( state,c_time,o_id,start_adress,end_adress,proposer,relevant_user,remarks,start_time,end_time,other ) VALUES( 1,'2','3','4','5','6','7','8','9','10','11' )
原因1
表名是数据库关键字
解决:1 更改数据库表名 2使用注解@Table(name = "
order")
之后发现新的继续录入