问题:
执行查询时报错:There is no getter for property named '*' in 'class java.lang.String
原因:
传过去的参数为识别。本例为

public interface TestMapper{
    List<Base> findAllBase(String search);
}
<select id="findAllBase" resultType="*.Base" parameterType="String">
        select id,name from t_base
        where 1=1
        <if test="search != null and search != ''">
            AND name LIKE CONCAT('%',#{search },'%')
        </if>
        order by id
</select>

解决方法:
1、在mapper接口增加参数设置,如下:

public interface TestMapper{
    List<Base> findAllBase(@Param(value="search") String search);
}

2、将具体报错的变量名更换为_parameter,如下:

<select id="findAllBase" resultType="*.Base" parameterType="String">
        select id,name from t_base
        where 1=1
        <if test="_parameter!= null and _parameter!= ''">
            AND name LIKE CONCAT('%',#{search },'%')
        </if>
        order by id
</select>

Mybatis查询报错:There is no getter for property named '*' in 'class java.lang.String的更多相关文章

  1. Mybatis 报错 There is no getter for property named '***' in 'class java.lang.String'

    在mapper.xml中 , 如果单参数是String类型 , 且在sql语句中对参数进行了判断 , 如下 when 中的判断 , 如果出现 if 判断也是一样的.都需要把判断中的参数用 _param ...

  2. mybatis 错误: There is no getter for property named '*' in 'class java.lang.String解决

    现象: mybatis mapper.xml 的sql里如果直接使用了想要传入的变量,比如: <select id="selectXx" resultType="i ...

  3. 【spring mvc】后台API查询接口,get请求,后台Date字段接收前台String类型的时间,报错default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'createDate';

    后台API查询接口,get请求,后台Date字段接收前台String类型的时间筛选条件 后台接口接收 使用的实体 而createDate字段在后台实体中是Date类型 报错信息: org.spring ...

  4. 【MyBatis学习06】_parameter:解决There is no getter for property named in class java.lang.String

    我们知道在mybatis的映射中传参数,只能传入一个.通过#{参数名} 即可获取传入的值. Mapper接口文件: public int delete(int id) throws Exception ...

  5. _parameter:解决There is no getter for property named in class java.lang.String

    我们知道在mybatis的映射中传参数,只能传入一个.通过#{参数名} 即可获取传入的值. Mapper接口文件: public int delete(int id) throws Exception ...

  6. mybatis There is no getter for property named '*' in 'class java.lang.String

    1.原因 server层     xxxx.get("1234") map <if test="aaa != null and aaa.id != null and ...

  7. Mybatis报错: There is no getter for property named xxx

    在mapper文件中函数的形参上加上注解. 例如: 出现了如下错误:核心错误提示就是There is no getter for property named xxx     ### Error qu ...

  8. mybatis报错,There is no getter for property named 'templateName' in 'class

    There is no getter for property named 'templateName' in 'class 主要原因是因为mapper.xml 的语句有错误,导致在bean里找不到相 ...

  9. MyBatis if test 传入一个数字进行比较报错 There is no getter for property named 'userState' in 'class java.lang.Integer'

    在写MyBatis映射文件中,我要传入一个 int 类型的参数,在映射文件中用 'test' 中进行比较,我花了很长时间百度,发现都是不靠谱的方法,有把数字在比较时转成字符串用 equals 比较的. ...

随机推荐

  1. bootstrap-datepicker控件中文 ,只显示年和只显示月份

    插件下载地址 https://github.com/uxsolutions/bootstrap-datepicker html <link href="css/bootstrap-da ...

  2. /proc/sys/net/ipv4/下各参数含义

    net.ipv4.tcp_tw_reuse = 0 表示开启重用.允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭 net.ipv4.tcp_tw_recycle = ...

  3. (转)mysql5.6.7多实例安装、配置的详细讲解分析及shell启动脚本的编写

    一.mysql安装 1.下载mysql数据库源码包: wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.27.tar.gz 2.安装mys ...

  4. Homemade Script Language: RED

    Made by C, named after RED(RecovEr from SaDness) 欢迎批评 :)

  5. [巩固C#] 一、特性是什么东东

    阅读目录   关闭   前言 特性是什么? 那么什么是“元数据”? 特性到底是什么? 我们自定义一个特性玩玩 什么是命名参数? 我们来继续要看看AttributeUsage(这个描... 自定义特性可 ...

  6. IIS下发布关于Excel导入导出时遇到的问题集锦(转)

    问题描述 1.Excel每个工作薄(sheet)生成记录行数 2.asp.net关于导出Excel的一些问题的集锦 3.下载失败,临时文件或其所在磁盘不可写 4.未能加载文件或程序集“Microsof ...

  7. 参数化拼接in查询条件,个人备份

    /// <summary>        /// 查询数据报表        /// </summary>        /// <param name="Tr ...

  8. python面试题——数据库和缓存(46题)

    1.列举常见的关系型数据库和非关系型都有那些? 2.MySQL常见数据库引擎及比较? 3.简述数据三大范式? 4.什么是事务?MySQL如何支持事务? 5.简述数据库设计中一对多和多对多的应用场景? ...

  9. 【Node.js】Stream(流)的学习笔记

    最近学习使用Node.js创建http proxy server,少不了要跟Stream打交道.昨天开始查阅一些资料,多少有了一些粗浅了解.整理在这里,供学习之用. 从Node.js API文档中可知 ...

  10. SPFieldLookupValue

    //得到查阅项的值SPWeb web = site.OpenWeb();SPList list = web.Lists["DemoList"];SPListItem item = ...