当前位置:网站首页>错误类型:反射。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
边栏推荐
- 【Day6】文件系统权限管理 文件特殊权限 隐藏属性
- 【Day8】磁盘及磁盘的分区有关知识
- Spark源码-任务提交流程之-6-sparkContext初始化
- 时间复杂度和空间复杂度
- spark算子-coalesce算子
- Spark source code - task submission process - 6-sparkContext initialization
- 【Day1】VMware软件安装
- One-arm routing and 30% switch
- Remembering my first CCF-A conference paper | After six rejections, my paper is finally accepted, yay!
- static routing
猜你喜欢
随机推荐
The Servlet to jump to the JSP page, forwarding and redirection
【Day8】使用LVM扩容所涉及的命令
Wechat applet page jump to pass parameters
I/O performance and reliability
Spark源码-任务提交流程之-6.1-sparkContext初始化-创建spark driver端执行环境SparkEnv
spark operator - map vs mapPartitions operator
Regular expression small example - get number character and repeated the most
运维的高光时刻,从智能化开始
LinkSLA坚持用户第一,打造可持续的运维服务方案
wc、grep、tar、vi/vim
【Day1】(超详细步骤)构建软RAID磁盘阵列
Apache configure reverse proxy
spark源码-任务提交流程之-3-ApplicationMaster
NIO工作方式浅析
入门文档10 资源映射
NIO works is analysed
lvm逻辑卷及磁盘配额
Spark source code-task submission process-6.1-sparkContext initialization-create spark driver side execution environment SparkEnv
入门文档05 使用cb()指示当前任务已完成
7步完成云上监控









