转载自://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-2843&1180】极地旅行社&OTOCI Link-Cut-Tree

    2843: 极地旅行社 Time Limit: 10 Sec  Memory Limit: 256 MBSubmit: 323  Solved: 218[Submit][Status][Discuss ...

  2. BZOJ-1925 地精部落 烧脑DP+滚动数组

    1925: [Sdoi2010]地精部落 Time Limit: 10 Sec Memory Limit: 64 MB Submit: 1053 Solved: 633 [Submit][Status ...

  3. system.badimageformatexception 未能加载文件或程序集问题解决

    原因是项目CPU默认X86我的系统是X64,将目标平台改为 Any CPU就可以了; 解决方法:

  4. Deep Learning in a Nutshell: Core Concepts

    Deep Learning in a Nutshell: Core Concepts This post is the first in a series I’ll be writing for Pa ...

  5. Python 科学计算涉及模块

    模块1.数据基础 numpy 模块2.数值运算 scipy 模块3.符号运算 sympy 模块4.图形绘制 matplotlib

  6. https://github.com/yrs244742688/GeneratePemWithMoAndEx RSA加密

    <RSAKeyValue> <Modulus> xA7SEU+e0yQH5rm9kbCDN9o3aPIo7HbP7tX6WOocLZAtNfyxSZDU16ksL6 Wjuba ...

  7. Linux下修改计算机名

    SuSe操作系统: 1.  修改/etc/HOSTNAME 文件  ,其内容为计算机名. 输入命令:vi /etc/HOSTNAME 使用键盘上的 x 键一个一个删除所有内容 ,然后使用键盘上的 i ...

  8. spring mvc实现查询

    实体类:User package cn.bdqn.pojo; public class User { private String userName; private String password; ...

  9. Web SQL数据库

    Web SQL数据库:它是一个独立的规范,引入了一组使用SQL操作客户端数据库的API. openDatabase方法:这个方法使用现有的数据库或者新建的数据库创建一个数据库对象.如果数据库存在,op ...

  10. linux下Nginx服务器安装教程

    序:Nginx服务器安装总结而已,不是教程. 安装的过程中出现了一些问题,原因我的云主机是纯净版,所以很多依赖包都没有.其中安装过程中就发现perl库缺少和openssl库缺少,因此我手动安装的这两款 ...