问题
org.apache.ibatis.exceptions.persistenceexception:
### error querying database. cause: org.apache.ibatis.reflection.reflectionexception: there is no getter for property named 'proname' in 'class com.smbms.pojo.provider'
### cause: org.apache.ibatis.reflection.reflectionexception: there is no getter for property named 'proname' in 'class com.smbms.pojo.provider'
解决方法
这个错误提示你的实体类的某个属性没有get方法那么你的
问题可能有以下三种
- 1.在实体类中的该属性名字写错了
- 2.在实体类中的该属性没有写get方法
- 3.在xxxmapper.xml文件中的该属性名字写错了
下面是我的错误之处
大家可以看到注释的部分为我之前的写错名字的属性,注释下面那行为修改后的
<select id="querybyidandproname" resulttype="com.smbms.pojo.provider"> select * from smbms_provider <where> <if test="id != null and id != ''"> and id = #{id} </if> <!-- <if test="proname != null and id != ''">--> <if test="proname != null and id != ''"> and proname like concat('%',#{proname},'%') </if> </where> </select>
再次运行之后的结果就是正确的了
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。
发表评论