当前位置:网站首页>错误类型:反射。ReflectionException:无法设置属性“xxx”的“类”xxx”与价值“xxx”
错误类型:反射。ReflectionException:无法设置属性“xxx”的“类”xxx”与价值“xxx”
2022-08-05 06:15:00 【Gentle elder brother `】
This is the full text of the problem I'm having:
Cause: org.apache.ibatis.reflection.ReflectionException: Could not set property 'providerName' of 'class com.smbms.pojo.Bill' with value 'Provider(id=null, proCode=null, proName=ShenzhenTaixiang Rice Co., Ltd., proDesc=null, proContact=null, proPhone=null, proAddress=null, proFax=null, createdBy=null, creationDate=null, modifyBy=null, modifyDate=null)' Cause: java.lang.IllegalArgumentException: argument type mismatch
In this case, he can still find out some of the results, but he will still report an error. The following picture is the console display of my error

Solution
This problem bothered me for an afternoon and was solved. In fact, the type of the resultMap tag under the complex type collection of a collection was written incorrectly, because I put myproviderName is defined as String type, but I wrote it as com.smbms.pojo.Provider in Type, which caused my program to have this problem all the time, even though I debugged a lot of other places to no avail.
This is my previous error code:
This is my modified code:
As you can see, change the type of the resultMap tag below to java.lang.String, and the operation is successful.
The following picture is the result after successful operation, you can see that the result found at this time is complete

But what makes me confused is that I changed javaType="com.smbms.pojo.Provider" to javaType=" java.lang.String" in the code below and stillThere is no mistake, I hope that friends who understand can leave a message in the comment area.
Supplementary knowledge points
collection
Collection of complex types, one-to-many
Inner nesting, mapping a nested result set to a list
Property property: The property of the entity object that maps the database column
ofType: full Java class name or alias (types included in the collection)
resultMap: reference to external resultMap
Child element id
result property: property of the entity object that maps the database column
边栏推荐
- 入门文档07 分阶段输出
- Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
- [Pytorch study notes] 8. How to use WeightedRandomSampler (weight sampler) when the training category is unbalanced data
- 增长:IT运维发展趋势报告
- time complexity and space complexity
- vim的三种模式
- 入职前,没想到他们玩的这么花
- Remembering my first CCF-A conference paper | After six rejections, my paper is finally accepted, yay!
- spark算子-map vs mapPartitions算子
- LeetCode Interview Questions
猜你喜欢
随机推荐
Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
Spark source code - task submission process - 4-container to start executor
深度 Zabbix 使用指南——来自惨绿少年
This is indeed the best article on microservice architecture I have read!
spark源码-任务提交流程之-2-YarnClusterApplication
Spark源码-任务提交流程之-6-sparkContext初始化
LinkSLA坚持用户第一,打造可持续的运维服务方案
【Day8】 RAID磁盘阵列
网络不通?服务丢包?看这篇就够了
正则表达式小示例--获取重复最多的字符及其数量
通过单总线调用ds18b20的问题
Small example of regular expression--remove spaces in the middle and on both sides of the string
[Day6] File system permission management, file special permissions, hidden attributes
The idea of commonly used shortcut key
I/O性能与可靠性
VLAN详解及实验
The problem of calling ds18b20 through a single bus
入门文档08 条件插件
IJCAI 2022|Boundary-Guided Camouflage Object Detection Model BGNet
spark算子-wholeTextFiles算子








