在xxxMapper.xml我们使用sql片段来提高sql代码的复用性,当时新手传入参数时常常出现这样的错误:

There is no getter for property named xxx' in 'class java.lang.xxx'

①出现的原因:我们实体类中有getter方法,为啥mybatis无法识别呢,原来Mybatis默认采用ONGL解析参数,所以会自动采用对象树形式来取java.lang.xxx.xxx值,所以引起报错。

②解决方法: 1)将传入参数改为_parameter这样就可以了,例如: 

<sql id="whereCadtion">
<if test="_parameter">
and AREA_ID=#{_parameter}
</if>
</sql>
<sql id="Base_Column_List">
ID,DEPT_NAME,USER_NAME,JOB_NAME,DAYS,ENTRY_CORE,AREA_ID,AREA_NAME
</sql>
<select id="findAllCarEntry" parameterType="int" resultMap="resultMap">
select <include refid="Base_Column_List"/> from vie_car_entry_top
<where>
<include refid="whereCadtion"/>
</where>
</select>

2)将接口参数名说明参数值。例如:

public List methodName(@Param(value="tj") String tj);

There is no getter for property named xxx' in 'class java.lang.xxx'的更多相关文章

  1. 关于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' ...

  2. mybaties报错:There is no getter for property named 'table' in 'class java.lang.String'

    报错是由于xml里获取不到这个table参数 package com.xxx.mapper; import java.util.List; import org.apache.ibatis.annot ...

  3. MyBatis查询传一个参数时报错:There is no getter for property named 'sleevetype' in 'class java.lang.Integer

    用MyBatis进行查询,传入参数只有一个时(非Map)如int,报错 There is no getter for property named 'sleevetype' in 'class jav ...

  4. There is no getter for property named 'purchaseApplyId' in 'class java.lang.Long'

    mapper.xml: <delete id="deleteByPurchaseAppyId" parameterType="Long"> < ...

  5. MyBatis3: There is no getter for property named 'code' in 'class java.lang.String'

    mybatis3  : mysql文如下,传入参数为string类型时‘preCode’,运行报错为:There is no getter for property named 'preCode' i ...

  6. 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 ...

  7. There is no getter for property named 'userId' in 'class java.lang.String'

    [ERROR] 2017-01-18 04:37:06:231 cn.dataenergy.common.CenterHandlerExceptionResolver (CenterHandlerEx ...

  8. mybaits错误解决:There is no getter for property named 'parentId ' in class 'java.lang.String'

    在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_parameter来代替参数名. 比如mapper中如下方法,只有一个String值 publ ...

  9. 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 ...

  10. Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'zoneId' in 'class java.lang.String'

    本文为博主原创,未经允许不得而转载: 异常展示: dao层定义的接口为: public int getClientTotal(); 在mybatis中的sql为: <select id=&quo ...

随机推荐

  1. Java虚拟机的内存结构

    我们都知道虚拟机的内存划分了多个区域,并不是一张大饼.那么为什么要划分为多块区域呢,直接搞一块区域,所有用到内存的地方都往这块区域里扔不就行了,岂不痛快.是的,如果不进行区域划分,扔的时候确实痛快,可 ...

  2. Prism for Xamarin.Forms

    一.使用环境 OS:Win 10 16273 VS:VS2017- 15.3.4 Xamarin:4.6.3.4,nuget:2.4 Android Emulator:Visual Studio fo ...

  3. 客户端与服务端,java与Android跨平台服务

  4. 201521123026《Java程序设计》第8周学习总结

    1. 本章学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结集合与泛型相关内容. 2. 书面作业 Q1.1.List中指定元素的删除(题目4-1) 1.1 实验总结 答: 1.通过equals ...

  5. 201521123117 《Java程序设计》第7周学习总结

    1. 本周学习总结 2.书面作业 Q1.ArrayList代码分析 1.解释ArrayList的contains源代码 源代码: //contains()方法 public boolean conta ...

  6. Java课程设计博客(团队)

    Java课程设计博客(团队) 1. 团队/项目名称 使用JAVA实现简易HTTP服务器 2. 团队成员 组长:林一心 组员:张杭镖 3. 项目git地址 https://github.com/oran ...

  7. python之路模块与包

    一.import加载的模块分为四个通用类别:          1 使用python编写的代码(.py文件) 2 已被编译为共享库或DLL的C或C++扩展 3 包好一组模块的包 4 使用C编写并链接到 ...

  8. Python爬虫2----------运用代理访问

    为request添加一个代理,及将浏览器头部信息加入,随机从ip列表中拿出一个ip进行访问 注意函数参数的形式,如request.proxyhandler(协议,地址) import urllib.r ...

  9. Oracle函数之chr

    chr()函数将ASCII码转换为字符:字符 –> ASCII码:ascii()函数将字符转换为ASCII码:ASCII码 –> 字符: 在oracle中chr()函数和ascii()是一 ...

  10. Lucene 搜索的初步探究

    搜索应用程序和 Lucene 之间的关系 一般的搜索引擎都会采用这样的 Lucene 采用的是一种称为反向索引(inverted index)的机制.反向索引就是说我们维护了一个词 / 短语表,对于这 ...