Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'

一、发现问题

<select id="queryStudentByNum" resultType="student" parameterType="string">

select num,name,phone from student  
<where> 
<if test = " num!=null and num!='' ">
AND num = #{num}
</if>
</where>
</select> 
Mybatis查询传入一个字符串传参数,报There is no getter for property named 'num' in 'class java.lang.String'。

二、解决问题

<select id="queryStudentByNum" resultType="student" parameterType="string">

select num,name,phone from student  
<where> 
<if test = "_parameter!=null">
AND num = #{_parameter}
</if>
</where>
</select>
无论参数名,都要改成"_parameter"。

三、原因分析

Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.num值,引起报错。也可以public List methodName(@Param(value="num") String num)的方法说明参数值

Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'的更多相关文章

  1. mybatis parameterType报错:There is no getter for property named 'xxx' in 'class java.lang.String'

    方法1: 当parameterType = "java.lang.String" 的时候,参数读取的时候必须为 _parameter 方法2: 在dao层的时候,设置一下参数,此方 ...

  2. Mybatis异常There is no getter for property named 'XXX' in 'class java.lang.String'

    1.当入参为 string类型时 (包括java.lang.String.)  我们使用#{xxx}引入参数.会抛异常There is no getter for property named 'XX ...

  3. 已解决: mybatis报错 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xxx' in 'class java.lang.String'

    最近在练习MyBatis时 进行姓名的模糊查询时候出现 org.apache.ibatis.exceptions.PersistenceException: ### Error querying da ...

  4. Mybatis异常--There is no getter for property named 'XXX' in 'class java.lang.String'

    第一种 在service层加@Param(value="ip") void deleteIpsetup(@Param(value="ip")String ip) ...

  5. Mybatis笔记四:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String'

    错误异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for pr ...

  6. 关于mybtis 使用过程中发生There is no getter for property named 'id' in class 'java.lang.String' 错误

    今天在修改一个关于mybtis语句时,偶然发现的一个错误  There is no getter for property named 'id' in class 'java.lang.String' ...

  7. mybatis There is no getter for property named 'xx' in 'class java.lang.String

    转载自://http://www.cnblogs.com/anee/p/3324140.html 用mybatis查询时,传入一个字符串传参数,且进行判断时,会报 There is no getter ...

  8. Mybatis问题:There is no getter for property named 'unitId' in 'class java.lang.String'

    Mybatis遇到的问题 问题: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.re ...

  9. mybatis之org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'time' in 'class java.lang.String'

    mybatis接口 List<String> getUsedCate(String time); 配置文件 <select id="getUsedCate" pa ...

随机推荐

  1. c 整数运算

    一.无符号加法(形式的模运算,无符号加法等价于计算模2w 的和) 示例:非负数 x 和 y 位数: w(8位机) 范围: 0 <= x,y <= 2w -1 结果:0 <= x+y ...

  2. python web中的文件上传与下载

    django 框架下 实现服务端的文件上传与下载: import jsonimport osimport uuid def attachment_upload(request): "&quo ...

  3. SDUT3143:Combinatorial mathematics(组合数学)

    题意:传送门 题目描述 As you know, shadow95 is pretty good at maths, especially combinatorial mathematics. Now ...

  4. BigData Technique&&Application指南-笔记1

    1.数据的量级 传统企业数据量基本上在TB之上,大型互联网企业达到了PB以上. 2.大量不同的数据类型  结构化数据:是存储在数据库里,可以用二维表来逻辑表达数据.  半结构的非结构化数据:一般都是纯 ...

  5. JVM类加载器工作流程

    类加载器 classloader:谈到类加载,不得不提的就是负责此项工作的类加载器classloader,classloader的职责是将Java源文件编译后的字节码文件加载到内存中去执行. 类加载至 ...

  6. python手写bp神经网络实现人脸性别识别1.0

    写在前面:本实验用到的图片均来自google图片,侵删! 实验介绍 用python手写一个简单bp神经网络,实现人脸的性别识别.由于本人的机器配置比较差,所以无法使用网上很红的人脸大数据数据集(如lf ...

  7. 使用yeoman起一个新项目(个人练习记录,勿喷!)

    1.首先安装yeoman:npm install -g yo2.yeoman需要generator来进行操作所以需要安装generator模块:npm install -g generator-web ...

  8. nginx的access_log与error_log(三)

    本篇介绍一下在nginx服务器的的两种日志的查看.   根据你找出来的地址,尽心vi编辑,进入nginx.conf文件进行查找路径     从而找到,我机子的两个日志存放地点: /var/logdat ...

  9. isEnable() 和 isDisplayed() 和 isSelected()

    isEnable().isDisplayed()和isSelected() 1.以上三个为布尔类型的函数 2.isEnable用于存储input.select等元素的可编辑状态,可以编辑返回true, ...

  10. 12.MySQL必知必会之分组数据

    本文将介绍如何分组数据,以便能汇总表内容的子集,这涉及两个新SELECT语句子句,分别是 GROUP BY 子句和HAVING子句. 1.1 创建分组 分组是在SELECT语句的GROUP BY子句中 ...