问题:
执行查询时报错: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. 我想和你们说说java和C++___C加加

    头痛头痛之一: java里面,本质上来说,一个类是一个程序员定义的类型,类是一种引用类型(reference type),这意味着该类类型的变量都可以引用该类的一个实例.从表面上,对象引用变量中似乎存 ...

  2. C++计算二叉树的节点数和高度

    用struct结构体的写法: /* * description: 计算二叉树的层数和节点数 * writeby: nick * date: 2012-10-23 16:16 * */ #include ...

  3. WPF 正確理解ContentPresenter

    我們先由下圖來看類層次,可知ContentControl繼承Control,ContentPresenter繼承FrameworkElement(Control也繼承FrameworkElement) ...

  4. 1.C#中的注释符

    1.软件行业的道德规范 (1).程序员在日常写代码的过程中,一定要养成注释的好习惯,方便后面对理解和使用. (2).在给标识符命名的时候一定要规范,有理有据的,名字不能瞎写. 2.注释 注释符的作用: ...

  5. 用户“Michael-PC\Michael”不具有所需的权限。请验证授予了足够的权限并且解决了 Windows 用户帐户控制(UAC)限制问题。

    解决方法:在注册表增加键值 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] 新建-选择“D ...

  6. 结合IL和Windbg来看.Net调用继承虚方法的执行顺序

    先上测试代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using ...

  7. Spring Boot集成Hibernate Validator

    废话不多说,直接开始集成环境. 一.环境集成 在项目中hibernate-Validator包在spring-boot-starter-web包里面有,不需要重复引用 .(整个Demo都是用PostM ...

  8. Spring课程 Spring入门篇 1-2Spring简介

    课程链接: 1 Spring是什么? 2 为什么是Spring 3 Spring的作用: 4 适用范围 1 Spring是什么? a 开源框架 b 轻量级的控制反转(Ioc)和面向切面编程(AOP)的 ...

  9. CSS改变placeholder的颜色

    :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #a1a1a1; } ::-moz-placeholder { /* Mozilla ...

  10. Udacity carnd2 Sensor Fusion, Extended Karman Filter (English)

    Extended Karman Filter Zhenglei 2018 January This is a project to estimate the car position from Lid ...