Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'
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'的更多相关文章
- mybatis parameterType报错:There is no getter for property named 'xxx' in 'class java.lang.String'
方法1: 当parameterType = "java.lang.String" 的时候,参数读取的时候必须为 _parameter 方法2: 在dao层的时候,设置一下参数,此方 ...
- 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 ...
- 已解决: 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 ...
- 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) ...
- 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 ...
- 关于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' ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- 全球数字货币交易所TOP20安全性评级报告
链塔智库2018-05-03 10:28 分析师:常昊.王婧雯 来源: 链塔智库 全球加密数字货币市值超2.5万亿元,单日交易额超2000亿元,全球超过3000万人已投入加密数字货币领域. ...
- 剑指Offer——二叉搜索树与双向链表
题目描述: 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的双向链表.要求不能创建任何新的结点,只能调整树中结点指针的指向. 分析: 二叉搜索树,中序遍历就是排序的. 所以我们利用中序遍历,将前后两 ...
- leetcode 去除单链表倒数第k个节点
Given a linked list, remove the n-th node from the end of list and return its head. Example: Given l ...
- ubuntu安装mysql步骤
https://dev.mysql.com/downloads/file/?id=477124 ubuntu上安装mysql非常简单只需要几条命令就可以完成. 1. sudo apt-get inst ...
- Golang&Python测试thrift
接上篇,安装好之后,就开始编写IDL生成然后测试. 一.生成运行 参考 http://www.aboutyun.com/thread-8916-1-1.html 来个添加,查询. namespace ...
- mysql 约束条件 auto_increment 自动增长 清空表 自动增长情况
清空表情况: mysql> delete from t20; Query OK, rows affected (0.00 sec) mysql> show create table t20 ...
- 006-Shell printf 命令
一.概述 printf 命令模仿 C 程序库(library)里的 printf() 程序. printf 由 POSIX 标准所定义,因此使用 printf 的脚本比使用 echo 移植性好. pr ...
- python 的弹框
import easygui easygui.msgbox("This is a message!", title="simple gui")
- 在MFC中实现对象之间数据的传递。
方法一: 第一步:在VS2010里面新建一个单文档MFC程序. 第二步:在App类里面的头文件里面 定义性声明一个变量 ,见下面程序 public: CString ii; 第三步:在App类的实现文 ...
- [C语言]删除用户自定义后缀名的所有文件
环境:win7 IDE:DEV-C++ 编译器:GCC 编译结果:Success 运行结果:Success 使用说明: 1.输入需要查询的目录,比如e: 2.输入需要删除的后缀名:比如:txt 注意: ...