当前位置:网站首页>错误类型:反射。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
边栏推荐
- 入门文档04 一个任务依赖另外一个任务时,需要按顺序执行
- spark source code - task submission process - 2-YarnClusterApplication
- 正则表达式小实例--验证邮箱地址
- Account and Permission Management
- spark算子-textFile算子
- Introductory document 05-2 use return instructions the current task has been completed
- 【Day8】Knowledge about disk and disk partition
- NIO工作方式浅析
- 【Day8】磁盘及磁盘的分区有关知识
- 【Day1】VMware软件安装
猜你喜欢
随机推荐
ALC实验
图片压缩失效问题
VLAN details and experiments
spark算子-repartition算子
spark operator-textFile operator
One-arm routing and 30% switch
Getting Started Document 07 Staged Output
【Day1】(超详细步骤)构建软RAID磁盘阵列
Remembering my first CCF-A conference paper | After six rejections, my paper is finally accepted, yay!
spark operator - map vs mapPartitions operator
Getting Started 05 Using cb() to indicate that the current task is complete
NIO工作方式浅析
idea 常用快捷键
入门文档08 条件插件
【Day5】软硬链接 文件存储,删除,目录管理命令
智能运维会取代人工运维吗?
[Day1] VMware software installation
网络不通?服务丢包?看这篇就够了
Getting Started Doc 06 Adding files to a stream
Regular expression small example - get number character and repeated the most