This question already has an answer here:
Syntax error due to using a reserved word as a table or column name in MySQL
                                
                                    (1个答案)
                                
                        
                                4年前关闭。
            
                    
我正在使用弹簧靴,我想添加新的“冠军”,这是代码

                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

最佳答案

OrderOrder By的保留字。将列名称更改为一些有意义的名称,然后检查。

10-08 04:43