一、发现问题

<select id="queryStudentByNum" resultType="student" parameterType="string">
select num,name,phone from student
<where>
<if test = " num!=null and num!='' ">
AND num = #{num}
</if>
</where>
</select> Mybatis查询传入一个字符串传参数,报There is no getter for property named 'num' in 'class java.lang.String'。 二、解决问题 <select id="queryStudentByNum" resultType="student" parameterType="string">
select num,name,phone from student
<where>
<if test = " _parameter!=null and_parameter!='' ">
AND num = #{_parameter}
</if>
</where>
</select> 无论参数名,都要改成"_parameter"。 三、原因分析 Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.num值,引起报错。也可以public List methodName(@Param(value="num") String num)的方法说明参数值

SSM框架报错分析(一)——There is no getter for property named 'XXX' in 'class java.lang.String'的更多相关文章

  1. mybatis parameterType报错:There is no getter for property named 'xxx' in 'class java.lang.String'

    方法1: 当parameterType = "java.lang.String" 的时候,参数读取的时候必须为 _parameter 方法2: 在dao层的时候,设置一下参数,此方 ...

  2. 已解决: 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 ...

  3. 【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 ...

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

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

  6. MyBatis if test 传入一个数字进行比较报错 There is no getter for property named 'userState' in 'class java.lang.Integer'

    在写MyBatis映射文件中,我要传入一个 int 类型的参数,在映射文件中用 'test' 中进行比较,我花了很长时间百度,发现都是不靠谱的方法,有把数字在比较时转成字符串用 equals 比较的. ...

  7. Bug--Mybatis报错:There is no getter for property named 'id' in 'class java.lang.Integer'

    Mybatis 添加@Param("")注释就可以了

  8. myecplise 打开报错 Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project 'myf'. Java.lang.NullPointerException

    Errors occurred during the build. Errors running builder 'DeploymentBuilder' on project 'myf'.Java.l ...

  9. Mybatis报错: There is no getter for property named xxx

    在mapper文件中函数的形参上加上注解. 例如: 出现了如下错误:核心错误提示就是There is no getter for property named xxx     ### Error qu ...

随机推荐

  1. HGOI 20180224 题解

    /* The Most Important Things: ljc chat with fyh on QQTa说期末考Ta数学74分感觉不好但是我觉得fyh是地表最强的鸭~~(of course en ...

  2. SharePoint “File not found” 错误

    Troubleshooting the SharePoint "File not found" Error Have you ever come across a "Fi ...

  3. 牛客练习赛 小D的Lemon 解题报告

    小D的Lemon 题意 已知 \[ g(x)=\left\{\begin{matrix} 1&,x=1\\ \sum_{i=1}^qk_i&,otherwise \end{matrix ...

  4. LoadRunner回放乱码

    乱码的原因和服务器字符集编码相关,默认LR是gbk解码,如果服务器是utf8,那么需要改为utf8解码,这样中文就显示正常了. 通过查看源码,可以知道服务器的编码方式:<meta charset ...

  5. A1071. Speech Patterns

    People often have a preference among synonyms of the same word. For example, some may prefer "t ...

  6. Java: |(或运算) 与 多选判断

    今天需要在程序中做一个多选判断,突然想起以前经常遇到的 x |= y | z; 这样的,我也明白这个是多选的用意,但为什么能达到我们希望的多选操作,我还真的没去研究过. 今天早上,百度了一下,搜索到了 ...

  7. typescript接口(学习笔记非干货)

    typescript的核心原则之一就是对所具有的shape类型检查结构性子类型化 One of the core principles of typescript is to check struct ...

  8. 斯坦福大学公开课机器学习:Neural network-model representation(神经网络模型及神经单元的理解)

    神经网络是在模仿大脑中的神经元或者神经网络时发明的.因此,要解释如何表示模型假设,我们先来看单个神经元在大脑中是什么样的.如下图,我们的大脑中充满了神经元,神经元是大脑中的细胞,其中有两点值得我们注意 ...

  9. 洛谷【P1523】旅行商的背包(算法导论 15-1) 题解

    P1523 旅行商简化版 题目背景 欧几里德旅行商\((Euclidean Traveling Salesman)\)问题也就是货郎担问题一直是困扰全世界数学家.计算机学家的著名问题.现有的算法都没有 ...

  10. MUI 拍照或选取照片上传作为头像

    1.第一种方法是用H5来实现的 HTML: <label> <input style="opacity: 0;" type="file" ac ...