Use mybatis to pass in parameters when the parameter type is string, integer, etc. If the if tag is used to determine whether the parameter is empty, there is no getter for property named ‘ID’ in ‘class java.lang.integer exception will be exploded.
Solution
1. Add @ param annotation to mapper interface parameters
List<User> selectUserById(@Param(value = "id") Integer id);
2、 It can be used when there is only one string or basic type parameter in your interface_ Parameter instead of parameter
<select id="selectUserById" resultType="com.zyq.entity.User" resultMap="userMap">
SELECT * FROM t_user
<where>
<if test="_parameter != null">
AND id = #{id}
</if>
</where>
</select>
Read More:
- Mybatis error,There is no getter for property named ‘xx’ in ‘class java.lang.String The solution
- 【PTA:】 Error: class X is public should be declared in a file named X.java
- Error in compiling pcl1.9.1: “class vtkdatasetmapper” has no member named “immediatemode rendering off”
- java.lang.IllegalArgumentException : could not get next sequenced ID for sequence name: Visitor solution
- Error in idea compilation: java.lang.OutOfMemoryError Java heap space and java.lang.StackOverflowError
- java.lang.IllegalArgumentException: column ‘_id’ does not exist
- Springboot startup error: java.lang.IllegalArgumentException : Property ‘sqlSessionFactory’ or ‘sqlSessionTempla
- Error: java.lang.IllegalArgumentExcept :Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required
- java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
- Setter and getter of JS class attribute
- Spring security failed to log in, error: there is no passwordencoder mapped for the ID “null”
- java.lang.AbstractMethodError: Receiver class com.alibaba.cloud.sentinel.feign.SentinelContractHolde
- java.lang.IllegalStateException : unable to read meta data for class
- There is a solution to the problem: severity = corrected, type = physical layer, id = 00e5 or id = 00e8 (receiver ID) under Ubuntu
- java.lang.NoSuchMethodError: org.json.JSONObject.put(Java/lang/String; Java/util/Collection;) “209151;”
- The @ Autowired annotation in springboot is invalid in ordinary classes. How to solve and use the null pointer exception java.lang.nullpointerexception
- [unity] Android package error java.lang.ClassNotFoundException Did not find class com.unity3d . player.MainActivity
- Leetcode: 7. Reverse Integer(JAVA)
- About the error querying database. Cause: java.lang.nullpointerexception reported in mybatis
- Android studio — java.lang.nullpointerexception(no error message)