前言

使用通用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测试,发现失败,这时候想到是关键字问题,使用引号括住关键字

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corres_sql

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' )

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corres_mysql_02

原因1

表名是数据库关键字

解决:1 更改数据库表名 2使用注解​​@Table(name = "​​​order​​")​

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corres_java_03

之后发现新的继续录入