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'

原文地址:https://www.cnblogs.com/feifeicui/p/9341462.html

时间: 2024-08-27 18:34:44

There is no getter for property named 'id' in class 'java.lang.String'的相关文章

mybaits错误解决:There is no getter for property named &#39;id&#39; in class &#39;java.lang.String&#39;(转)

在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_parameter来代替参数名. 正确的写法: [html] view plain <span style="font-size:18px;">    <!-- 用于查询运单号是否存在 --> <select id="isCargoBillNoExist" resultType="java.lang.Integer&quo

mybaits错误解决:There is no getter for property named &#39;id&#39; in class &#39;java.lang.String&#39;

在使用mybaitis传参数的时候,如果仅传入一个类型为String的参数,那么在 xml文件中应该使用_parameter 来代替参数名. 正确的写法: [html] view plaincopyprint? <span style="font-size:18px;">    <!-- 用于查询运单号是否存在 --> <select id="isCargoBillNoExist" resultType="java.lang.

错误解决:There is no getter for property named &#39;id&#39; in class &#39;java.lang.String&#39;

使用mybatis传入参数,如果在mappin.xml中使用<if>标签判断该参数是否为空,通常会报以上异常,解决方法:?在接口中该方法的参数前加上@Param("参数名")注解,即可? 错误解决:There is no getter for property named 'id' in class 'java.lang.String' 原文地址:https://www.cnblogs.com/lqh969696/p/11578492.html

关于mybtis 使用过程中发生There is no getter for property named &#39;id&#39; in class &#39;java.lang.String&#39; 错误

今天在修改一个关于mybtis语句时,偶然发现的一个错误  There is no getter for property named 'id' in class 'java.lang.String', 纠结了许久,终于明白了为什么. 原因:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取 string.xxx 值,如果没在在方法中定义,则会抛异常报错.当然也不是所有的版本会有这个问题,我的项目用的版本比较老. 有两种解决方案: 方案一: 将对应的参数用 _parameter

关于 There is no getter for property named &#39;id&#39; in &#39;class java.lang.Integer&#39;

在写SSM框架的时候,请求报出 There is no getter for property named 'id' in 'class java.lang.Integer'这个问题 但是实际上实体类中写了相关的方法,最后找到问题出现在Mapper接口中, List<User> getAllUser( Integer id); 将代码改为: List<User> getAllUser(@Param("id") Integer id); 问题解决 方法2 当map

org.apache.ibatis.reflection.ReflectionException: There is no getter for property named &#39;parentId&#39; in &#39;class java.lang.String&#39;

Caused by: org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'parentId' in 'class java.lang.String' at org.apache.ibatis.reflection.Reflector.getGetInvoker(Reflector.java:333) at org.apache.ibatis.reflection.Meta

Mybatis问题:There is no getter for property named &#39;unitId&#39; in &#39;class java.lang.String&#39;

Mybatis遇到的问题 问题: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'unitId' in 'class java.lang.String' at org.mybatis.spring.MyBatisExceptionTransla

MyBatis3: There is no getter for property named &#39;code&#39; in &#39;class java.lang.String&#39;

mybatis3  : mysql文如下,传入参数为string类型时‘preCode’,运行报错为:There is no getter for property named 'preCode' in 'class java.lang.String 执行sql: mapper.xml文件: <select id="getMaxCode" parameterType="string" resultType="string"> sele

Mybatis中传参包There is no getter for property named &#39;XXX&#39; in &#39;class java.lang.String&#39;

一.发现问题 <select id="queryStudentByNum" resultType="student" parameterType="string"> select num,name,phone from student <where> <if test = " num!=null and num!='' "> AND num = #{num} </if> <