Mybatis查询报错:There is no getter for property named '*' in 'class java.lang.String
问题:
执行查询时报错: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的更多相关文章
- Mybatis 报错 There is no getter for property named '***' in 'class java.lang.String'
在mapper.xml中 , 如果单参数是String类型 , 且在sql语句中对参数进行了判断 , 如下 when 中的判断 , 如果出现 if 判断也是一样的.都需要把判断中的参数用 _param ...
- mybatis 错误: There is no getter for property named '*' in 'class java.lang.String解决
现象: mybatis mapper.xml 的sql里如果直接使用了想要传入的变量,比如: <select id="selectXx" resultType="i ...
- 【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 ...
- 【MyBatis学习06】_parameter:解决There is no getter for property named in class java.lang.String
我们知道在mybatis的映射中传参数,只能传入一个.通过#{参数名} 即可获取传入的值. Mapper接口文件: public int delete(int id) throws Exception ...
- _parameter:解决There is no getter for property named in class java.lang.String
我们知道在mybatis的映射中传参数,只能传入一个.通过#{参数名} 即可获取传入的值. Mapper接口文件: public int delete(int id) throws Exception ...
- 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 ...
- Mybatis报错: There is no getter for property named xxx
在mapper文件中函数的形参上加上注解. 例如: 出现了如下错误:核心错误提示就是There is no getter for property named xxx ### Error qu ...
- mybatis报错,There is no getter for property named 'templateName' in 'class
There is no getter for property named 'templateName' in 'class 主要原因是因为mapper.xml 的语句有错误,导致在bean里找不到相 ...
- MyBatis if test 传入一个数字进行比较报错 There is no getter for property named 'userState' in 'class java.lang.Integer'
在写MyBatis映射文件中,我要传入一个 int 类型的参数,在映射文件中用 'test' 中进行比较,我花了很长时间百度,发现都是不靠谱的方法,有把数字在比较时转成字符串用 equals 比较的. ...
随机推荐
- 往mysql数据库中上传路径问题
String path = System.getProperty("catalina.home"); String fileName = mo ...
- 安装、使用eclipse+CDT编译C++程序
我想安装.使用eclipse+CDT的初衷在看live555的源码,需要方便管理源码的工具: 使用eclipse编译和管理live555源码 http://blog.csdn.net/nkmnkm/a ...
- Unity GetComponentsInChildren
1 Component.GetComponentsInChildren 和 GameObject.GetComponentsInChildren 一样吗? API上解释一样. 2. //拿到游戏对象 ...
- Day3监督学习——决策树原理
Day3 机器学习监督学习——决策树原理 一.决策树的原理 1.机器学习中分类和预测算法的评估: 准确率 速度 强壮型:有数据缺失或错误时算法的运行 可规模性:数量级规模比较大 可解释性 2.决策树( ...
- java多线程之原子变量
看链接博客:http://blog.csdn.net/u011116672/article/details/51068828
- 实现Nginx中使用PHP-FPM时记录PHP错误日志的配置方法
最近在本地搭建的LNMP的开发环境.为了开发的时候不影响前端的正常开发就屏蔽的PHP里面php.ini中的一些错误提示.但是这样一来,就影响到了后端开发的一些问题比如不能及时调试开发中的一些问题 ng ...
- TouchSlide 触屏滑动特效插件
TouchSlide 是纯javascript打造的触屏滑动特效插件,面向手机.平板电脑等移动终端,能实现触屏焦点图.触屏Tab切换.触屏多图切换等常用效果. 插件开源.体积小.简单实用.功能强大,是 ...
- jquery validation yyyy-MM-dd格式日期在ie中无法验证通过
自己开发的公众号,可以领取淘宝内部优惠券 问题 首先在ie6.7.8下面打开这个页面http://jqueryvalidation.org/date-method/,输入的日期格式为:yyyy-MM- ...
- 移动端纯CSS3制作圆形进度条所遇到的问题
近日在开发的页面中,需要制作一个动态的圆形进度条,首先想到的是利用两个矩形,宽等于直径的一半,高等于直径,两个矩形利用浮动贴在一起,设置overflow:hidden属性,作为盒子,内部有一个与其宽高 ...
- [COM Interop学习小结]实现一个C#调用C++的示例
最近在研究产品的架构代码,发现其中涉及到Com组件技术,即项目中的C# Project会通过Com接口来调用C++ Project中的方法,研究一下,实现一个小的例子,供自己学习. 一. 什么是COM ...