There is no getter for property named 'id' in class 'java.lang.String'

Posted o_0

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了There is no getter for property named 'id' in class 'java.lang.String'相关的知识,希望对你有一定的参考价值。

https://blog.csdn.net/u011897392/article/details/46738747

使用mybatis传入参数,如果在mappin.xml中使用<if>标签判断该参数是否为空,通常会报以上异常,解决方法:?在接口中该方法的参数前加上@Param("参数名")注解,即可?

接口:

public interface UserMapper {

 

 

//根据名称查询用户

List<MAP> queryUserByName(@Param("name")String name);

 

}?

mapping.xml:?

<mapper namespace="com.mybatis.test.dao.UserMapper">
<select id="queryUserByName" parameterType="String" resultType="java.util.HashMap">
select 
t_id as id,
t_name as name,
t_password as password
from mybatis_user
where 1=1 
<if test="name != null">
and t_name=#{name}
</if>
order by t_id
</select>
</mapper>

 














以上是关于There is no getter for property named 'id' in class 'java.lang.String'的主要内容,如果未能解决你的问题,请参考以下文章

mybatis出现There is no getter for property named ...的原因及解决办法

There is no getter for property named 'NULL' in ……

Mybatis单个参数报错: There is no getter for property named

Mybatis单个参数报错: There is no getter for property named

Mybatismybatis查询报错org.apache.ibatis.reflection.ReflectionException: There is no getter for propert(代

Mybatis单个参数的if判断(针对异常:There is no getter for property..)------mybatis的内置对象