一、发现问题

<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. Python的单向链表实现

    思路 链表由节点组成,先规定节点(Node),包含data和指向下个节点的next 初始化 data当然就是传入的data了,next指向None 添加 分两种情况: 链表为空,那么头节点和尾节点都指 ...

  2. 【BZOJ2208】[JSOI2010]连通数(Tarjan)

    [BZOJ2208][JSOI2010]连通数(Tarjan) 题面 BZOJ 洛谷 题解 先吐槽辣鸡洛谷数据,我写了个\(O(nm)\)的都过了. #include<iostream> ...

  3. linux 分区、目录及用途

    主要分区: 目录 建议大小 格式 描述 / 10G-20G ext4 根目录 swap <2048M swap 交换空间 /boot 200M左右 ext4 Linux的内核及引导系统程序所需要 ...

  4. POSIX 线程取消点的 Linux 实现

    http://blog.csdn.net/stevenliyong/article/details/4364039 原文链接:http://blog.solrex.cn/articles/linux- ...

  5. CodeBlocks: 生成的exe文件自定义一个图标

    CodeBlocks生成的exe文件的图标默认是系统图标,如何自定义一个漂亮的小图标呢? 我是C菜鸟,平时只用CodeBlocks练习c,也不开发什么软件,这个问题就难倒我了. 到网上搜索了一下,发现 ...

  6. 一次有趣的ant-design与后端数据交互的使用

    最近有个需求是新闻时间排序与点击量排序,数据库中存储的新闻是按照时间顺序排序的,从后台数据中取出数据,在前端进行页面展示即可. 我用到了ant-design中的Tabs切换页,样式大概如下图. 其实这 ...

  7. 类的内置方法__attr__介绍

    1.hasattr  getaddr  setaddr delattr 这四个函数同样也适用于类 class BlackMedium: feture="Ugly" def __in ...

  8. JVM综合调优汇总

    一.堆大小设置 JVM 中最大堆大小有三方面限制: 1. 相关操作系统的数据模型(32-bt还是64-bit)限制: 2. 系统的可用虚拟内存限制: 3. 系统的可用物理内存限制. 32位系统下,一般 ...

  9. vue2.0 之事件处理器

    事件绑定v-on(内置事件) <template> <div> <a v-if="isPartA">partA</a> <a ...

  10. yolo3的改变

    转自:https://zhuanlan.zhihu.com/p/35394369 YOLOv3的前世今生 2013年,R-CNN横空出世,目标检测DL世代大幕拉开. 各路豪杰快速迭代,陆续有了SPP, ...