转载自://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. Dedecms include\dialog\select_soft_post.php Upload Any Files To The Specified Directory Via Variable Not Initial Flaw Bypass Extension Defence

    目录 . 漏洞描述 . 漏洞触发条件 . 漏洞影响范围 . 漏洞代码分析 . 防御方法 . 攻防思考 1. 漏洞描述 综合来说,这个漏洞的根源是"register_globals = on& ...

  2. (转)google Java编程风格中文版

    转:http://www.hawstein.com/posts/google-java-style.html 目录 前言 源文件基础 源文件结构 格式 命名约定 编程实践 Javadoc 后记 前言 ...

  3. java初学的分析

    java初学的分析第一阶段:入门阶段学习目标:简单项目开发学习内容:1.Java入门书籍,Java基础知识.关于Java入门级的书,给大家推荐过<Java编程思想>.<Java核心技 ...

  4. Handler.dispatchMessage handleMessage

    "main@3972" prio=5 runnable java.lang.Thread.State: RUNNABLE at com.ease.financialoa.modul ...

  5. 软件开发过程中的审查 (Review)

    http://blog.csdn.net/horkychen/article/details/5035769 软件开发过程中的审查 (Review)   希望别人做些什么->定义出流程 希望别人 ...

  6. json(2)

    JSON 语法规则 JSON 语法是 JavaScript 对象表示法语法的子集. 数据在名称/值对中 数据由逗号分隔 花括号保存对象 方括号保存数组 JSON 名称/值对 JSON 数据的书写格式是 ...

  7. javascript 的button onclick事件不起作用的解决方法

    在项目中遇到个问题:servlet向前端返回如下按钮,当course_ID为数字是onclick事件正常,但当course_ID含有字母时onclick事件就不起作用.网上找了很多方法都不管用,最后自 ...

  8. SCI完全攻略:从构思到发表

  9. Visual Studio IIS Express 不支持.json后缀的mime类型

    vs默认web调试工具中并不支持.json后缀的mime类型. 如何解决,两个方案: 局部单应用:web.config: <system.webServer> .... <stati ...

  10. CentOS 7 firewalld使用简介

    1.firewalld简介 firewalld是centos7的一大特性,最大的好处有两个:支持动态更新,不用重启服务:第二个就是加入了防火墙的“zone”概念   firewalld有图形界面和工具 ...