当前位置:网站首页>How to package the parsed Excel data into objects and write this object set into the database?
How to package the parsed Excel data into objects and write this object set into the database?
2022-07-07 04:46:00 【CSDN Q & A】
The phenomenon and background of the problem
Today, I am learning parsing Excel file , Write the parsed data into the database , But the parsed data is a set , I don't know how to write to the database , Always report mistakes
Problem related code , Do not paste screenshots
mapper Code

mybatis Of xml file

service layer


This is a controller layer , Will be resolved list The objects in the collection are written to the database

This is the analysis Excel Get the object

This is the content of the error report , I didn't know how to do it for hours , Write only list The first one in the collection , The latter cannot be written into the database
org.apache.ibatis.binding.BindingException: Mapper method 'com.xjh.exceljiexi.mapper.UserExcelModelMapper.insert' has an unsupported return type: class com.xjh.exceljiexi.domain.UserExcelModel
at org.apache.ibatis.binding.MapperMethod.rowCountResult(MapperMethod.java:118) ~[mybatis-3.5.9.jar:3.5.9]
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:62) ~[mybatis-3.5.9.jar:3.5.9]
at org.apache.ibatis.binding.MapperProxy$PlainMethodInvoker.invoke(MapperProxy.java:145) ~[mybatis-3.5.9.jar:3.5.9]
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:86) ~[mybatis-3.5.9.jar:3.5.9]
at com.sun.proxy.$Proxy59.insert(Unknown Source) ~[na:na]
at com.xjh.exceljiexi.service.impl.UserExcelModelImpl.addUser(UserExcelModelImpl.java:24) ~[classes/:na]
at com.xjh.exceljiexi.controller.FileController.readExcel(FileController.java:53) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_301]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_301]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_301]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_301]
This error has been stuck for threeorfour hours , How to modify the code to complete this function ? Ask for an answer
Take the answer :
Have a look at , I didn't find anything wrong , But I have a little suggestion , You can set breakpoints when inserting data into the database , Check the currently inserted domain Whether the object is wrong , If it's normal , That means all your previous codes are correct , Only myBatis There are some problems here . Then continue to look slowly
边栏推荐
- Depth first traversal template principle of tree and graph
- 九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
- Advertising attribution: how to measure the value of buying volume?
- ESG全球领导者峰会|英特尔王锐:以科技之力应对全球气候挑战
- 【数模】Matlab allcycles()函数的源代码(2021a之前版本没有)
- ACL2022 | 分解的元学习小样本命名实体识别
- 【线段树实战】最近的请求次数 + 区域和检索 - 数组可修改+我的日程安排表Ⅰ/Ⅲ
- [team learning] [34 issues] scratch (Level 2)
- The easycvr platform is connected to the RTMP protocol, and the interface call prompts how to solve the error of obtaining video recording?
- On the 110th anniversary of Turing's birth, has the prediction of intelligent machine come true?
猜你喜欢
![[on automation experience] the growth path of automated testing](/img/28/38d82cbdc7ed249d376fff264d1b5d.png)
[on automation experience] the growth path of automated testing

Break the memory wall with CPU scheme? Learn from PayPal to expand the capacity of aoteng, and the volume of missed fraud transactions can be reduced to 1/30

Ssm+jsp realizes the warehouse management system, and the interface is called an elegant interface

Vscode 如何使用内置浏览器?

Why does WordPress open so slowly?

【实践出真理】import和require的引入方式真的和网上说的一样吗
![[practice leads to truth] is the introduction of import and require really the same as what is said on the Internet](/img/58/4337f0972f7171a5c21e640f03e0b7.png)
[practice leads to truth] is the introduction of import and require really the same as what is said on the Internet
![[team learning] [34 issues] scratch (Level 2)](/img/29/8383d753eedcffd874bc3f0194152a.jpg)
[team learning] [34 issues] scratch (Level 2)

Video fusion cloud platform easycvr video Plaza left column list style optimization

The request request is encapsulated in uni app, which is easy to understand
随机推荐
【线段树实战】最近的请求次数 + 区域和检索 - 数组可修改+我的日程安排表Ⅰ/Ⅲ
How to open win11 remote desktop connection? Five methods of win11 Remote Desktop Connection
未婚夫捐5亿美元给女PI,让她不用申请项目,招150位科学家,安心做科研!
一图看懂!为什么学校教了你Coding但还是不会的原因...
Comment les tests de logiciels sont - ils effectués sur le site Web? Testez la stratégie!
窗口可不是什么便宜的东西
Unit test asp Net MVC 4 Application - unit testing asp Net MVC 4 apps thoroughly
Jetson nano configures pytorch deep learning environment / / to be improved
Up to 5million per person per year! Choose people instead of projects, focus on basic scientific research, and scientists dominate the "new cornerstone" funded by Tencent to start the application
案例大赏:英特尔携众多合作伙伴推动多领域AI产业创新发展
Digital chemical plants realize the coexistence of advantages of high quality, low cost and fast efficiency
Chapter 9 Yunji datacanvas company has been ranked top 3 in China's machine learning platform market
The request request is encapsulated in uni app, which is easy to understand
各路行业大佬称赞的跨架构开发“神器”,你get同款了吗?
Master the secrets of software security testing methods, and pinch the security test report with your hands
[on automation experience] the growth path of automated testing
Acl2022 | decomposed meta learning small sample named entity recognition
《原动力 x 云原生正发声 降本增效大讲堂》第三讲——Kubernetes 集群利用率提升实践
Both primary and secondary equipment numbers are 0
EasyCVR无法使用WebRTC进行播放,该如何解决?