转载自://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. BZOJ-1878 HH的项链 树状数组+莫队(离线处理)

    1878: [SDOI2009]HH的项链 Time Limit: 4 Sec Memory Limit: 64 MB Submit: 2701 Solved: 1355 [Submit][Statu ...

  2. Linux Kernel File IO Syscall Kernel-Source-Code Analysis(undone)

    目录 . 引言 . open() syscall . close() syscall 0. 引言 在linux的哲学中,所有的磁盘文件.目录.外设设备.驱动设备全部被抽象为了"文件" ...

  3. 数组实现栈的结构(java)

    自定义数组实现栈的结构. package test; public class MyArrayStackClient { public static void main(String[] args) ...

  4. jQuery的查找

    children([expr])概述 :取得一个包含匹配的元素集合中每一个元素的所有子元素的元素集合.可以通过可选的表达式来过滤所匹配的子元素.注意:parents()将查找所有祖辈元素,而child ...

  5. GNUPLOT画图工具

    http://blog.csdn.net/codingkid/article/details/7211492 不得不说这个工具实在是太强大了. 1.首先命令简单,不会有那么多的语法问题. 2.其次画图 ...

  6. PHP利用Filesystem函数实现操作缓存(生成,获取,删除操作)

    <?php class File{ //$key 相当于缓存文件的文件名 //$value 缓存数据 private $_dir;//定义默认路径 const EXT='.txt'; publi ...

  7. Linux的一个暴力破解工具九头蛇hydra

    首先还是书写本文的 参考档:http://www.cnblogs.com/mchina/archive/2013/01/01/2840815.html 工具介绍:原文为官方英文解释本人给翻译下 数量最 ...

  8. Swift Tour 随笔总结 (4)

    Switch的一个例子: let vegetable = "red pepper" switch vegetable { case "celery": let ...

  9. springmvc 定时器

    CronTrigger配置格式: 格式: [秒] [分] [小时] [日] [月] [周] [年] 序号 说明  是否必填  允许填写的值 允许的通配符 1  秒  是  0-59    , - *  ...

  10. sql中文字符串获取拼音首字母

    SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO )) ) as begin ),) set @PY='' begin ) --如果非汉字字符,返回原字 ...