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 比较的. ...
随机推荐
- sql server 2017安装
下载: 1. 2. 3. 安装步骤: https://www.cnblogs.com/ksguai/p/5869558.html 管理工具: Microsoft SQL Server Manageme ...
- maya2012无法安装卸载激活失败
AUTODESK系列软件着实令人头疼,安装失败之后不能完全卸载!!!(比如maya,cad,3dsmax等).有时手动删除注册表重装之后还是会出现各种问题,每个版本的C++Runtime和.NET f ...
- Murano Weekly Meeting 2015.09.29
Meeting time: 2015.September.29th 1:00~2:00 Chairperson: Serg Melikyan, PTL from Mirantis Meeting s ...
- 关于web.xml的welcome-file-list 配置与tomcat的关系:
关于web.xml的welcome-file-list 配置与tomcat的关系: 2018年04月18日 10:17:13 守望dfdfdf 阅读数:377 标签: welcome-file-lis ...
- Spring文件下载
package com.smbea.demo.controller; import java.io.BufferedInputStream; import java.io.BufferedOutput ...
- POS开发问题 - 缓存问题 - 02
问题描述 : 有一个A页面使用了缓存,当从别的页面返回到A页面时, A页面绑定的有些事件,例如监听输入框输入事件:"input",监听点击触摸屏事件:"touchstar ...
- input type="file"获取文件名方法
文件上传比较丑,样式调整时会有一个获取文件名,或者包含文件路径的文件名的方法 html代码 <div class="file-box"> <form id=&qu ...
- 如何在K3 WISE BOS集成开发工具中自定义字段过滤条件
1.结论 对于输入过滤条件后BOS报“列名不正确”的过滤条件,要在列名前增加x2标识 无效的过滤 FNumber ,,,,,) 正确的过滤 x2.FNumber ,,,,,) 2.完全可以不看的探索过 ...
- three.js学习笔记--基础知识
基础知识 从去年开始就在计划中的three.js终于开始了 历史介绍 (摘自ijunfan1994的转载,感谢作者) OpenGL大概许多人都有所耳闻,它是最常用的跨平台图形库. WebGL是基于Op ...
- <Android 基础(九)> Ndk配置与Demo
介绍 The NDK is a toolset that allows you to implement parts of your app using native-code languages s ...