当前位置:网站首页>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
边栏推荐
- Advertising attribution: how to measure the value of buying volume?
- Fiance donated 500million dollars to female PI, so that she didn't need to apply for projects, recruited 150 scientists, and did scientific research at ease!
- Win11玩绝地求生(PUBG)崩溃怎么办?Win11玩绝地求生崩溃解决方法
- EasyCVR无法使用WebRTC进行播放,该如何解决?
- 抖音或将推出独立种草社区平台:会不会成为第二个小红书
- NTU notes 6422quiz review (1-3 sections)
- In depth analysis of kubebuilder
- Vscode 如何使用内置浏览器?
- This "advanced" technology design 15 years ago makes CPU shine in AI reasoning
- jvm是什么?jvm调优有哪些目的?
猜你喜欢
Lessons and thoughts of the first SQL injection
AI 落地新题型 RPA + AI =?
DFS和BFS概念及实践+acwing 842 排列数字(dfs) +acwing 844. 走迷宫(bfs)
C#使用西门子S7 协议读写PLC DB块
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
Kivy tutorial of setting the size and background of the form (tutorial includes source code)
计数排序基础思路
Introduction to the PureMVC series
MySQL数据库(基础篇)
各路行业大佬称赞的跨架构开发“神器”,你get同款了吗?
随机推荐
R语言主成分pca、因子分析、聚类对地区经济研究分析重庆市经济指标
EasyCVR平台接入RTMP协议,接口调用提示获取录像错误该如何解决?
Mathematical analysis_ Notes_ Chapter 10: integral with parameters
[practice leads to truth] is the introduction of import and require really the same as what is said on the Internet
Organize five stages of actual attack and defense drill
案例大赏:英特尔携众多合作伙伴推动多领域AI产业创新发展
B站大佬用我的世界搞出卷积神经网络,LeCun转发!爆肝6个月,播放破百万
MySQL forgot how to change the password
Digital chemical plants realize the coexistence of advantages of high quality, low cost and fast efficiency
Advertising attribution: how to measure the value of buying volume?
jvm是什么?jvm调优有哪些目的?
Terms used in the Web3 community
Data security -- 12 -- Analysis of privacy protection
Why does WordPress open so slowly?
A series of shortcut keys for jetbrain pychar
Video fusion cloud platform easycvr video Plaza left column list style optimization
Intel David tuhy: the reason for the success of Intel aoten Technology
What is Web3
Easycvr cannot be played using webrtc. How to solve it?
Nanopineo use development process record