Mybatis-There is no getter for property named 'id' in 'class java.lang.String'
程序员文章站
2022-04-05 12:58:01
...
<select id="findNoteByID" parameterType="string" resultType="note"> SELECT * FROM TABLE <where> <choose> <when test="id != null and id !='' ">id = #{id}</when> <otherwise>1=2</otherwise> </choose> </where> </select>
在测试时报错:There is no getter for property named 'id' in 'class java.lang.String'
问题分析:Mybatis默认采用ONGL解析参数,所以会自动采用对象树的形式取string.id值,引起报错。
解决方法: public Note findNoteByID(@Param(value="id") String id);说明参数值。
推荐阅读
-
There is no getter for property named ‘name‘ in ‘class java.lang.String‘
-
There is no getter for property named ‘name‘ in ‘class java.lang.String
-
Mybatis报错:There is no getter for property named ‘xxxx‘ in ‘class xxxx
-
Mybatis报错:There is no getter for property named 'xxxx' in 'class xxxx
-
Mybatis报错:There is no getter for property named ‘xxxx‘ in ‘class xxxx
-
Mybatis报错:There is no getter for property named ‘xxxx‘ in ‘class xxxx
-
There is no getter for property named 'xxx' in 'class java.lang.xxxx'解决办法
-
Mybatis There is no getter for property named 'xxxx' in 'class java.lang.String'
-
There is no getter for property named 'xxx' in 'class com.ams.ams.entity.xxx'
-
Mybatis There is no getter for property named 'XXX' in 'class java.lang.XXX