com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax;



SQL: insert into order      ( user_id,                       order_id,                       product_id,                       consumer_name,                       dev_number,                       rant_month,                       total_fee,                       create_time,                              remark )       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 'order
     ( user_id,
      
      
        order_id,
      
      
        prod' at line 1
; bad SQL grammar []; nested exception is 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 'order
     ( user_id,
      
      
        order_id,
      
      
        prod' at line 1] with root 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 'order
     ( user_id,
      
      
        order_id,
      
      
        prod' at line 1

运用mybatis逆向工程生成项目 添加一条数据报错第一行代码错误 一开始以为是应用层的问题 Dao以上的代码哪里错了 后来去数据库排查才发现是表名和预留字冲突问题 表名为order了 order为保留字段 所以报错了 把表名改个名字就好了

挖坑

你可能感兴趣的:(JAVA)