org.springframework.jdbc.BadSqlGrammarException:
### Error querying database. 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 WHERE id = 5' at line 1
### The error may exist in file [I:\workspace\workspace_wxjc\creation-help\creation-help-server\target\classes\mybatis\mapper\order-mapper.xml]
### The error may involve com.wxjc.creation.dao.impl.OrderDAOImpl.getById-Inline
### The error occurred while setting parameters
### SQL: SELECT * FROM order WHERE id = ?
### 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 WHERE id = 5' 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 WHERE id = 5' at line 1
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:237)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:365)
at com.sun.proxy.$Proxy23.selectOne(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160)
at com.nskbearing.core.dao.BaseDAOImpl.getById(BaseDAOImpl.java:125)

以上是错误提示,提示:

SELECT * FROM  order  WHERE id = ?;

提示org.springframework.jdbc.BadSqlGrammarException:

放到mysql的客户端执行,也报错

SELECT * FROM  order  WHERE id = 1;
/* SQL错误(1064):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 WHERE id = 1' at line 1 */
/* Affected rows: 0 已找到记录: 0 警告: 0 持续时间 0 of 1 query: 0.000 sec. */

最终解决:

SELECT * FROM  `order`  WHERE id = 1;

这样解决了。
在mybatis中使用:
<sql id="t_order">`order`</sql>

解决!!!
 

mysql中表名是order的CRUD的错误的更多相关文章

  1. MySQL中表名大小写问题

    在设计数据表时,有自己特有的规则:英文单词的首字母大写,比如表名User, Article, UserRole, 等等,这种办法使用得很顺手习惯,在以往使用的MS SQL Server.MS Acce ...

  2. MySQL中表名重命名

    第一种办法:##修改表名, TO 或AS都可以,也以省略掉 ## ALTER TABLE 表名 RENAME [TO|AS] 新表名 ALTER TABLE user10 RENAME TO user ...

  3. MySQL表名和数据库关键字相同解决办法

    今天改他们的代码的时候,遇到了MySQL表名和数据库关键字的问题. 由于表名是关键字,导致增删改查都报错. Hibernate: select leave0_.id as id22_, leave0_ ...

  4. [mysql] mysql表名忽略大小写

    首先查看mysql是否区分大小写: 今天郁闷死了,在LINUX下调一个程序老说找不到表,但是我明明是建了表的,在MYSQL的命令行下也可以查到,为什么程序就找不到表呢? 后来请教了一个老师才搞定,原来 ...

  5. 【转】MySQL表名大小写敏感导致的问题

    原文地址:https://blog.csdn.net/postnull/article/details/72455768 最近在项目中遇到一个比较奇怪的小问题.在开发过程中自己测试没有问题,但是提测后 ...

  6. MySQL表名大小写敏感导致的问题

      最近在项目中遇到一个比较奇怪的小问题.在开发过程中自己测试没有问题,但是提测后,测试的同时在测试一个功能时报错了,日志是: Caused by: com.mysql.jdbc.exceptions ...

  7. MySQL字段名与保留字冲突的问题及解决方法

    问题:MySQL字段名与保留字冲突在实际操作是常常出现的.一把会出现下面错误. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException. 解 ...

  8. 【MySql】linux下,设置mysql表名忽略大小写

    [障碍再现] 状况描述01:     在LINUX下调一个程序经常报出找不到表,但是我明明是建了表的,     测试的时候,遇到一些问题,从Windows平台访问虚拟机中的Web应用,经常报出找不到表 ...

  9. mysql表名忽略大小写问题记录

    问题描述:一开发同事在linux下调一个程序老是报错说找不到表,但是登陆mysql,show tables查看明明是已经创建了这张表的!!如下: mysql> show tables; +--- ...

随机推荐

  1. Spring入门_04_注解注入

    applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xm ...

  2. webapi支持跨域访问

    写在前面 在实际应用中,跨域请求还是比较常见的,如何上接口直接支持跨域的访问呢? demo 场景项目A有个接口用来获取用户列表,现在项目b也有个功能需要加载用户列表.这两个项目在两个域名下,至少端口好 ...

  3. MySQL中MAX函数与Group By一起使用的注意事项(转)

    mysql> select * from test; +----+-------+------+-------+ | id | name | age | class | +----+------ ...

  4. unslider的用法详解

    unslider本身下载后只需要dist文件夹就好了, 其中只包含dist/js/unslider-min.js, jquery的js要自己提供; dist/css/unslider.css是主要的c ...

  5. (准备写)URAL1824 Ifrit Bomber 题解

    http://acm.timus.ru/problem.aspx?space=1&num=1824 1824. Ifrit Bomber Time limit: 0.5 second Memo ...

  6. Web 前端

    全栈的定义是什么? 如果 前端开发/后端开发/部署/运维 都能hold住就算full stack, 我现在都overflow stack了, 需求/架构/开发/项目管理/运维 都做.  单开发这块, ...

  7. 【AngularJS】—— 9 自定义过滤器

    AngularJS另一个特点就是提供了过滤器,可以通过操作UNIX下管道的方式,操作数据结果. 通过使用管道,可以便于双向的数据绑定中视图的展现. 过滤器在处理过程中,将数据变成新的格式,而且可以使用 ...

  8. gitlab一键安装 (转)

    原文地址:http://www.2cto.com/os/201411/353292.html 0 简介bitnami和gitlab bitnami BitNami是一个开源项目,该项目产生的开源软件包 ...

  9. BeanFactory和ApplicationContext的区别

     1.BeanFactory和ApplicationContext的异同点: 相同点:     两者都是通过xml配置文件加载bean,ApplicationContext和BeanFacotry相比 ...

  10. C语言中的#define预处理指令

    本文链接:http://www.cnblogs.com/xxNote/p/4009460.html 今天看C Primer Plus里面看449页里面 16.2.1语言符号 讲到从技术方面看,系统把宏 ...