zoukankan      html  css  js  c++  java
  • mysql中表名是order的CRUD的错误

    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:workspaceworkspace_wxjccreation-helpcreation-help-server	argetclassesmybatismapperorder-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>

    解决!!!
     
  • 相关阅读:
    国内的cdn
    React Native商城项目实战01
    react-native 项目实战 -- 新闻客户端(7) -- 新闻详情页
    react-native 项目实战 -- 新闻客户端(6) -- 完善ListView头部视图
    react-native 项目实战 -- 新闻客户端(5) -- 完善首页列表数据
    react-native 项目实战 -- 新闻客户端(4) -- 请求网络数据
    react-native 项目实战 -- 新闻客户端(3) -- 包装导航控制器
    react-native 项目实战 -- 新闻客户端(2) -- 完善TabBar
    react-native 项目实战 -- 新闻客户端(1) -- 初始化项目结构
    react-native 制作购物车ShopCart
  • 原文地址:https://www.cnblogs.com/gmq-sh/p/5393654.html
Copyright © 2011-2022 走看看