来自于:http://blog.csdn.net/woshixuye/article/details/8820387
一、发现问题
<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_parameter!='' ">
AND num = #{_parameter}
</if>
</where>
</select>
无论参数名,都要改成"_parameter"。
三、原因分析
Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.num值,引起报错。也可以public List methodName(@Param(value="num") String num)的方法说明参数值
参考博客:
http://blog.sina.com.cn/s/blog_86e49b8f010191hw.html
http://txin0814.iteye.com/blog/1533645
相关推荐
今天小编就为大家分享一篇关于Mybatis单个参数的if判断报异常There is no getter for property named 'xxx' in 'class java.lang.Integer'的解决方案,小编觉得内容挺不错的,现在分享给大家,具有很好的参考价值,...
主要介绍了使用Mybatis遇到的there is no getter异常,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧
解决Mybatis 分页插件pagehelper不支持逆向工程Example条件查询.含源码和jar包
/** finder.mybatis **/ 1、项目摘要:mybatis hello,world demo 2、开发环境:开发工具-->Myeclipse10.0 java环境-->JDK1.6 数据库环境-->Oracle11g Mybatis版本:3.2.2 log4j版本:1.2.17 3、数据库: ...
SpringBoot 整合 MyBatis。解决因Mybatis-Spring版本过高引起的“Caused by: java.lang.IllegalArgumentException: Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required”异常
总结了Mybatis传递参数的几种方式,并对几种方式进行比较,另外还有一些参数的限制说明
Mybatis的动态传参介绍及log4j的日志记录功能的实现,以及二级缓存的应用。
两天因为项目需要整合spring、struts2、mybatis三大框架,但启动的时候总出现这个错误,困扰我好久,折腾了好久终于找到问题根源,下面小编给大家分享下问题所在及解决办法,一起看看吧
NULL 博文链接:https://listen-raining.iteye.com/blog/1962065
sessionFactory 用的,里面主要包含了数据库连接相关东西,还有 java 类所对应的别名,比如 <typeAlias alias="User" type="com.yihaomen.mybatis.model.User"/> 这个别名非常重要,你在 具体的类的映射中,比如User...
Spring+Jersey+Mybatis小实例,为了搭建这个折腾了两天,其中一天是因为jar包版本引起的,一直报异常:java.lang.AbstractMethodError: javax.ws.rs.core.UriBuilder.uri(Ljava/lang/String;)Ljavax/ws/rs/core/...
主要给大家介绍了mybatis中foreach报错:_frch_item_0 not found的解决方法,文章通过示例代码介绍了详细的解决方法,对大家具有一定的参考学习价值,需要的朋友们下面来一起看看吧。
mybatis3.4.2,包含jar包和源码。
常问问题1,出现了如下BUG org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'statement' in 'class ...
java mybatis的jar包 欢迎使用
MyBatis SQL mapper framework for Java.zip
Mybatis中执行String类型的自己拼写的sql,不执行配置文件中的sql mybatis sql connection mybatis中使用sql,不实用配置文件中的sql实例
nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [mybatis- config.xml]; nested exception is org.apache.ibatis.builder....
java开发中使用mybatis框架需要用到的独立jar包,java开发中使用mybatis框架需要用到的独立jar包,java开发中使用mybatis框架需要用到的独立jar包,java开发中使用mybatis框架需要用到的独立jar包,
mybatis相关jar包.zip