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

2023-11-16

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);



本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐