问题:
执行查询时报错: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. CentOS 7 修改root 密码

    环境: 1.重启系统在加载内核的地方按e,编辑启动脚本 2.将ro crashkernel = auto 所在地的 ro 替换为 rw init=/sysroot/bin/sh 3.修改完成后用Ctr ...

  2. mac 下安装 mysql

    1. 下载mysql community server 2. 下载mysql workbench 3. 启动mysql server 4. 进入mysql命令行 5. 修改root密码 ALTER U ...

  3. linux下文件比对功能

    很想对吧两个文本有什么不同,可linux下有没有那么方便的工具,怎么办?其实也很简单:diff命令,一行搞定. 新建a.txt文件

  4. HDU 5352——MZL's City——————【二分图多重匹配、拆点||网络流||费用流】

    MZL's City Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total ...

  5. C#使用MediaInfo查看媒体信息

    1.将MediaInfo.dll放入可执行目录. 2.将官网Demo里的MediaInfoDLL.cs放入项目中.(http://mediainfo.sourceforge.net/en/Downlo ...

  6. Java执行Shell脚本

    Linux 系统下采用 Java 执行 Shell 脚本,直接上代码: package com.smbea.demo; import java.io.BufferedReader; import ja ...

  7. HTML标签_1

    <meta charset="utf-8" /> 设置字符集 <meta name="description" content="这 ...

  8. ASP.NET 页面之间传递参数方法

    1.通过URL链接地址传递 (1) send.aspx代码 protected void Button1_Click(object sender, EventArgs e) { Request.Red ...

  9. c++ stl sort example

    c++ stl sort函数使用举例: #include <iostream> #include<vector> #include<algorithm> #incl ...

  10. centos7 安装sqlserver驱动以及扩展

    安装sqlserver驱动 sudo su curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repo ...