Record the problems encountered in learning SSM framework 3
Exception Reporting
Message Request processing failed; nested exception is org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property=‘id’, mode=IN, javaType=class java.lang.Integer, jdbcType=null, numericScale=null, resultMapId=‘null’, jdbcTypeName=‘null’, expression=‘null’}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #3 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2).
Description The server encountered an unexpected condition that prevented it from completing the request.
The problem occurs mainly in the mapper.xml file and can be due to several reasons.
1. two #’s are written together and will be identified incorrectly (my error)
<update id="updateById" parameterType="main.java.com.dy.domain.News">
update news
<set>
<include refid="News_update"/>
</set>
where id=##{id}
</update>
2. JavaEE comments appear inside/**/
<update id="updateById" parameterType="main.java.com.dy.domain.News">
update news
<set> /* */
<include refid="News_update"/>
</set>
where id=#{id}
</update>
3. #{id} covered with quotation marks
<update id="updateById" parameterType="main.java.com.dy.domain.News">
update news
<set>
<include refid="News_update"/>
</set>
where id='#{id}'
</update>
All the above detailed errors may lead to errors in the execution of SQL statements, so we should be as careful as possible in the future development process.
Read More:
- [Solved] mybatis plus Insert Error: mybatis plus Error setting null for parameter #1 with JdbcType OTHER
- [Solved] Java.lang.IllegalStateException: Type handler was null on parameter mapping for property ‘__frch_it
- [Solved] Javaweb Error: inStream parameter is null
- [Solved] Error getting generated key or setting result to parameter object. UnsupportedOperationException
- Not showing null elements JAVA [How to Solve]
- How to Solve Error: Error parsing mapper XML
- mybatis Error: All elements are null [How to Solve]
- Uncaught TypeError: Cannot read property ‘toFixed‘ of null
- NULL value exception occurs when freemarker renders the page globally in the springboot project
- Dubbo failed to register and consumer null pointer exception
- JUnit tests mybatis-plus error: null pointer [How to Solve]
- [Solved] TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:IllegalStateException: null
- Mybatis Error: All elements are null [How to Solve]
- [Solved] Kafka Error: Discovered coordinator XXXXX:9092 (id: 2147483647 rack: null) for group itstyle.
- [Solved] Openfegn Remote Call Error: java.lang.NullPointerException: null
- [Solved] Cause: org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration
- JNI ERROR (2354): JNI connection is NULL [How to Solve]
- Java uses single thread pool to realize multi thread sequential execution (non alternating, non synchronous)
- [Solved] Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException
- [Solved] o2o Error: addShopImg error:null / character to be escaped is missing