zoukankan      html  css  js  c++  java
  • invalid comparison: java.util.ArrayList and java.lang.String解决

    报错:

    Caused by: org.apache.ibatis.exceptions.PersistenceException: 
    ### Error querying database.  Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.ArrayList and java.lang.String
    ### Cause: java.lang.IllegalArgumentException: invalid comparison: java.util.ArrayList and java.lang.String

    原因:

    我的orderStates是一个数组格式,我此处判断的是 orderStates!=null,故报错。应该改成orderState.size()>0

    <if test="orderStates !=null and orderStates!=''">
          AND State in
            <foreach collection="orderStates" item="state"  open="(" separator="," close=")" >
                #{state}
            </foreach>
        </if>

    正确书写如下:

    <if test="orderStates !=null and orderStates.size > 0">
          AND State in
            <foreach collection="orderStates" item="state"  open="(" separator="," close=")" >
                #{state}
            </foreach>
        </if>
  • 相关阅读:
    相关系数
    T检验
    Python模块常用的几种安装方式
    DOM与SAX读取XML方式的不同
    Base64编码
    node.js网页爬虫
    Node.js Express 框架
    Node.js Web 模块
    Node.js GET/POST请求
    Node.js 常用工具
  • 原文地址:https://www.cnblogs.com/yangyuke1994/p/10454602.html
Copyright © 2011-2022 走看看