【问题标题】:SQL syntax error with spring boot [duplicate]Spring Boot的SQL语法错误[重复]
【发布时间】:2015-08-06 00:49:37
【问题描述】:

我正在使用 Spring Boot,我想添加新的“冠军”,这是代码

                Champ c  = new Champ();
                c.setOrder(1);
                c.setType("RRRR");
                c.setStructurenotification("#AA");
                champservice.AddNewChamp(c);

表"champ" 有字段:"idchamp", "structidstructurenotification" ,"type" and "order".

但我得到了这个错误

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, 
structidstructurenotification, type, idchamp)
 values (1, '#AA', 'RRRR', 0' at line 1

【问题讨论】:

  • 我认为它是因为“订单”它 Ordery 是 Order By 的关键字..更改列名并尝试

标签: mysql sql spring-boot


【解决方案1】:

Order 是Order By 的保留字。将列名更改为一些有意义的名称并检查。

【讨论】:

  • @software 很高兴它有帮助..将其标记为已回答
  • Thnx...因为Order word 花了 4 天。我试图创建表名顺序
  • @AkshayTaru :) 很高兴它有帮助
猜你喜欢
  • 2015-03-15
  • 2020-01-17
  • 2023-03-05
  • 2018-12-12
  • 2019-06-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多