Error instantiating class java.lang.Integer with invalid types () or values (). Cause: java.lang.NoSuchMethodException: java.lang.Integer.()
1. Background: when multiple parameter values are passed into the column of collection in mybatis, an error is reported
2. Solution:
an entity class in your one to many relationship. In the corresponding mapper.xml, the parametertype of SQL method must be in the form of map
<select id="getMaskRuleByMaskStrategyId" parameterType="java.util.Map" resultMap="MaskRuleResultWithMaskTypeMap">
select * from t_capaa_maskstrategy_mask_strategy_conf a left join t_capaa_maskstrategy_mask_rule b on a.mask_rule_id = b.id
where mask_strategy_id = #{maskStrategyId,jdbcType=INTEGER}
</select>
Solution:
Be sure to type parametertype as map, otherwise, in the column
of the collection
tag, you cannot use the format of {K1 = V1, K2 = V2}
.
Read More:
- Mybatis single parameter pass in exception (How to Fix)
- [Solved] Mybatis Error: attempting to get column ‘XX’ from result set
- Ruoyi-cloud Integrated mybatis-plus Error: Unknown column ‘search_value‘ in ‘field list‘
- [Solved] Tk-Mybatis Error: tk.mybatis.mapper.MapperException:
- [Solved] Mybatis Error: Could not find resource mybatis-conf.xml
- [Solved] Mybatis.generator error: Failed to execute goal org.mybatis.generator:mybatis-generator-maven-plugin:1.3.2
- [Solved] mybatis plus Insert Error: mybatis plus Error setting null for parameter #1 with JdbcType OTHER
- [Solved] Mapped Statements collection does not contain value for xxx
- Mybatis Error: The error may exist in xxxxMapper.xml [How to Solve]
- Mybatis query error: Exception in thread “main” org.apache.ibatis.exceptions.PersistenceException…
- Mybatis Error: Invalid bound statement (not found)
- [Solved] Error updating database. Cause: java.sql.SQLException: Incorrect integer value: ‘**‘ for column
- How to Solve SQL comments error in the mybatis query
- [Solved] Mybatis insert Error: Cause: java.sql.SQLException: SQL String cannot be empty
- [Solved] Error attempting to get column ‘xxxx_time‘ from result set. Cause: java.sql.SQLFeatureNotSupportedEx
- Build a mybatis and it will appear session.selectOne Method error
- mybatis-plus Common Error and Their Solution
- Mybatis Error: Error instantiating class bakou.entity.Person with invalid types () or value)
- Mybatis-plus: How to Execute Native SQL
- Mybatis sets the primary key Auto-Increment error: No setter found for the keyProperty