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 比较的. ...
随机推荐
- GO WEB
1.第一个坑的就是,错误信息如下: 比较常见的错误“Connection reset by peer”,该错误和“Connection reset”是有区别的: 服务器返回了“RST”时,如果此时客户 ...
- TCP连接的ISN、连接建立超时及TCP的长短连接
问题现象: 一.TCP连接的ISN 之前我们说过初始建立TCP连接的时候的系列号(ISN)是随机选择的,那么这个系列号为什么不采用一个固定的值呢?主要有两方面的原因 防止同一个连接的不 ...
- eclipse启动的时候报错An internal error occurred during: "Initializing Java Tooling"
eclipse ->windows ->Perspactive -> Reset perspactive 重置视图可以解决
- Powershell(3)
Powershell 可以使用powershell管理的服务 share point, exchange, lync, windows azure, window server, system cen ...
- 【补充】docker基础学习
docker 基础知识 之前写了一篇docker未授权访问的文章,现在来补充一下docker基础知识,以便更好的学习docker上的漏洞. docker是一款轻量级的虚拟化的产品,它属于层级化的架构. ...
- carousel 插件隐藏列表中几项导致左右切换出错
1. 一般的应用场景: 用于左右快速切换显示的列表内容,比如对员工的切换. 对于这种情况必不可少需要按照部门进行搜索,目前我的做法是首次加载所有该用户可以查看的员工列表,选择部门后又选择的隐藏掉其他不 ...
- intellijidea课程 intellijidea神器使用技巧 6-1 Spring的关联
待学完spring之后再来看 Spring的关联位置:菜单->File->Project Structure->Facets功能:帮助管理Spring容器.还提供了很多其他的管理,比 ...
- 洛谷P4925 [1007]Scarlet的字符串不可能这么可爱(计数)
题意 题目链接 Sol 只要知道"回文连续子串"就能做了吧.. 想要满足这个条件,肯定是不能出现\(aa\)或\(aba\)这种情况 如果没有\(S\)的限制,答案为\(K * ( ...
- Jquery插件之ajaxForm简介
我们平常在使用jQuery异步提交表单的时候,一般都是加载在submit事件中,如下所示: $(document).ready(function(){ $('#myForm').submit(func ...
- 小米手机连接adb只显示List of devices attached
使用appium的过程中,与同事交换了下手机,突然连接adb只提示List of devices attached,没有内容了咩~ 后来看到C大的帖子,http://blog.cofface.com/ ...