JBOSS 点滴

丰丰的博客

Spring+Mybatis 查询所有数据时发生异常:org.apache.ibatis.reflection.ReflectionException: There is no getter for

Spring+Mybatis框架整合时,根据条件查询数据,发生异常
Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'sname' in 'class java.lang.String'
userinfoMapper.xml文件:
<select id="findAll" parameterType="string" resultMap="userinfoMap">  select * from userinfo where sname like '%${sname}%' </select>
UserinfoMapper接口:

public List<Userinfo> findAll(String sname);
解决方法:在参数前加@Param标签
public List<Userinfo> findAll(@Param("sname") String sname);

posted on 2019-05-11 16:05 半导体 阅读(1587) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: