转载自://http://www.cnblogs.com/anee/p/3324140.html

用mybatis查询时,传入一个字符串传参数,且进行判断时,会报

  1. There is no getter for property named 'moduleCode' in 'class java.lang.String

错误写法:

  1. <select id="queryAllParentModule" resultType="jobModule" parameterType="jobModule">
  2. select modulecode,
  3. modulename,
  4. modulevalue,
  5. linkurl,
  6. rank,
  7. parentmodule=isnull(parentmodule,1),
  8. moduledescription
  9. from job_module
  10. <where>
  11. <choose>
  12. <when test="moduleCode!=null and moduleCode!=''">modulecode = #{moduleCode}</when>
  13. <when test="moduleCode==null or moduleCode==''">(parentmodule is null or len(parentmodule)&lt;=0)</when>
  14. </choose>
  15. </where>
  16. lt;/select>

需要修改成:

  1. <select id="queryModuleByCode" resultType="jobModule" parameterType="string">
  2. select modulecode,
  3. modulename,
  4. modulevalue,
  5. linkurl,
  6. rank,
  7. parentmodule=isnull(parentmodule,1),
  8. moduledescription
  9. from job_module
  10. <where>
  11. <choose>
  12. <when test="_parameter!=null and _parameter!=''">modulecode = #{_parameter}</when>
  13. <when test="_parameter==null or _parameter==''">(parentmodule is null or len(parentmodule)&lt;=0)</when>
  14. </choose>
  15. </where>
  16. lt;/select>

不管你的参数是什么,都要改成"_parameter"

REFERENCES:http://txin0814.iteye.com/blog/1533645


---------------------------------------------------------------------------------------------------------------------------------
copyright:http://www.cnblogs.com/anee/

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

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

  2. mybatis之org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'time' in 'class java.lang.String'

    mybatis接口 List<String> getUsedCate(String time); 配置文件 <select id="getUsedCate" pa ...

  3. mybatis问题: There is no getter for property named 'equipmentId' in 'class java.lang.String'

    本文来源于翁舒航的博客,点击即可跳转原文观看!!!(被转载或者拷贝走的内容可能缺失图片.视频等原文的内容) 若网站将链接屏蔽,可直接拷贝原文链接到地址栏跳转观看,原文链接:https://www.cn ...

  4. Mybatis笔记四:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'id' in 'class java.lang.String'

    错误异常:nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for pr ...

  5. Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String'

    Mybatis中传参包There is no getter for property named 'XXX' in 'class java.lang.String' 一.发现问题 <select ...

  6. 【Mybatis】mybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'areaName' in 'class java.lang.String'

    mybatis查询报错: Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for pro ...

  7. 已解决: mybatis报错 org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'xxx' in 'class java.lang.String'

    最近在练习MyBatis时 进行姓名的模糊查询时候出现 org.apache.ibatis.exceptions.PersistenceException: ### Error querying da ...

  8. org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'socialCode' in 'class java.lang.String'

    异常: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Refl ...

  9. Mybatis异常There is no getter for property named 'XXX' in 'class java.lang.String'

    1.当入参为 string类型时 (包括java.lang.String.)  我们使用#{xxx}引入参数.会抛异常There is no getter for property named 'XX ...

随机推荐

  1. CodeMap

    CodeMap 这是在博客园看到的一位朋友文章介绍的,很好用的插件,所有的方法,注释块在右边一目了然,找代码方便极了,还能设置代码段的高亮,给代码段设置标识

  2. JAVA多线程经典范列:生产者与消费者

    * 第一:生产者 生产的消费品 存放到仓库中,当仓库满时,生产者停止生产 * 第二:消费者 到仓库中 使用消费品,当仓库没有消费品时,停止消费 * 第三:生产者 在仓库满停止生产后 通知消费者去消费 ...

  3. 使用multi curl进行http并发访问

    curl是一款利用URL语法进行文件传输的工具,它支持多种协议,包括FTP, FTPS, HTTP, HTTPS, GOPHER, TELNET等,我们既可以在命令行上使用它,也可以利用 libcur ...

  4. HD 1533 Going Home(最小费用最大流模板)

    Going Home Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total ...

  5. Nagios配置和命令介绍(二 )

    Nagios配置 Nagios 主要用于监控一台或者多台本地主机及远程的各种信息,包括本机资源及对外的服务等.默认的Nagios 配置没有任何监控内容,仅是一些模板文件.若要让Nagios 提供服务, ...

  6. 锋利的jQuery-4--$(document).ready()和window.onload方法的区别

    jQuery中的$(document).ready()和JavaScript中的window.onload方法主要有两个方面的不同: 1.执行时机: onload : 网页中所有的元素和元素的关联文件 ...

  7. MySQL主从分离读写复制

    参考教程:http://www.yii-china.com/post/detail/283.html MySQL是开源的关系型数据库系统.复制(Replication)是从一台MySQL数据库服务器( ...

  8. mlecms v2.2版权

    inc\tools\smarty 下的Smarty.class.php文件. 找到 187行左右 我们会发现原来的  $dopud =$_template->libfile($dopud);已经 ...

  9. iOS-Auto property synthesis will not synthesize property 'delegate'; it will be implemented by its super

    今天在XCode6.3上面重写TabBar的时候,自定义tabBar的代理遇到的一个问题 在重写tabBar的代理的时候遇到了一个警告. 解决方法: 在.m文件中 警告消失.

  10. C#中的volatile用法

    volatile 影响编译器编译的结果,指出,volatile 变量是随时可能发生变化的,与volatile变量有关的运算,不要进行编译优化,以免出错,(VC++ 在产生release版可执行码时会进 ...