ForHeartOnly
2017-05-05 09:42
采纳率: 0%
浏览 2.9k

Mybatis XML数据查询foreach list 循环出来的结果报如下错误

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0613b2f5fd1542f7a0733371e490cbc8' in 'where clause'


and a.order_tab_id in

${orderId}

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

6条回答 默认 最新

  • sql语法错误,你可以在控制台或者日志文件,找到打印的sql.

    打赏 评论
  • ForHeartOnly 2017-05-05 09:46

    017-05-05 16:48:16 -70737 [http-bio-8080-exec-1] INFO - Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
    2017-05-05 16:48:16 -70808 [http-bio-8080-exec-1] INFO - SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase]
    2017-05-05 16:48:16 -70826 [http-bio-8080-exec-1] DEBUG - {conn-10002, pstmt-20024} enter cache
    2017-05-05 16:48:16 -70830 [http-bio-8080-exec-1] ERROR - org.springframework.jdbc.BadSqlGrammarException:

    Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0613b2f5fd1542f7a0733371e490cbc8' in 'where clause'

    The error may exist in file [/Volumes/mySpace/workSpace/Pro/fstc/out/artifacts/fstc_war_exploded/WEB-INF/classes/mybatis/citydelivery/CdsOrderMapper.xml]

    The error may involve CdsOrderMapper.datalistPage-Inline

    The error occurred while setting parameters

    Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0613b2f5fd1542f7a0733371e490cbc8' in 'where clause'

    ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0613b2f5fd1542f7a0733371e490cbc8' in 'where clause'
    org.springframework.jdbc.BadSqlGrammarException:

    Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0613b2f5fd1542f7a0733371e490cbc8' in 'where clause'

    The error may exist in file [/Volumes/mySpace/workSpace/Pro/fstc/out/artifacts/fstc_war_exploded/WEB-INF/classes/mybatis/citydelivery/CdsOrderMapper.xml]

    The error may involve CdsOrderMapper.datalistPage-Inline

    The error occurred while setting parameters

    Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0613b2f5fd1542f7a0733371e490cbc8' in 'where clause'

    ; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '0613b2f5fd1542f7a0733371e490cbc8' in 'where clause'
    at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:231)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
    at com.sun.proxy.$Proxy17.selectList(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:194)
    at cn.com.hexway.dao.DaoSupport.findForList(DaoSupport.java:141)
    at cn.com.hexway.service.citydelivery.cdsorder.CdsOrderService.list(CdsOrderService.java:70)
    at cn.com.hexway.service.citydelivery.cdsorder.CdsOrderService$$FastClassBySpringCGLIB$$245dd553.invoke()
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:708)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644)
    at cn.com.hexway.service.citydelivery.cdsorder.CdsOrderService$$EnhancerBySpringCGLIB$$98447f66.list()

    打赏 评论
  • qq_37739083 2017-05-05 09:47

    贴出sql语句以及控制台打印出来的异常

    打赏 评论
  • ForHeartOnly 2017-05-05 09:55


    and a.order_tab_id in

    ${orderId}

    打赏 评论
  • GaoEn1020 2017-05-05 09:55

    你的sql语句发出来看看

    打赏 评论
  • jinchanglee 2017-05-05 10:46

    separator=“UNION”

    打赏 评论

相关推荐 更多相似问题