当前位置:网站首页>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
边栏推荐
- Organize five stages of actual attack and defense drill
- Case reward: Intel brings many partners to promote the innovation and development of multi domain AI industry
- [digital analog] source code of MATLAB allcycles() function (not available before 2021a)
- What if the win11 screenshot key cannot be used? Solution to the failure of win11 screenshot key
- DFS和BFS概念及实践+acwing 842 排列数字(dfs) +acwing 844. 走迷宫(bfs)
- The worse the AI performance, the higher the bonus? Doctor of New York University offered a reward for the task of making the big model perform poorly
- 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!
- Intel David tuhy: the reason for the success of Intel aoten Technology
- Both primary and secondary equipment numbers are 0
- Ssm+jsp realizes the warehouse management system, and the interface is called an elegant interface
猜你喜欢
[multi threading exercise] write a multi threading example of the producer consumer model.
案例大赏:英特尔携众多合作伙伴推动多领域AI产业创新发展
Have you got the same "artifact" of cross architecture development praised by various industry leaders?
EasyCVR集群版本添加RTSP设备提示服务器ID错误,该如何解决?
AI landing new question type RPA + AI =?
The easycvr platform is connected to the RTMP protocol, and the interface call prompts how to solve the error of obtaining video recording?
【实践出真理】import和require的引入方式真的和网上说的一样吗
How to solve the problem of adding RTSP device to easycvr cluster version and prompting server ID error?
The request request is encapsulated in uni app, which is easy to understand
Depth first traversal template principle of tree and graph
随机推荐
DFS和BFS概念及实践+acwing 842 排列数字(dfs) +acwing 844. 走迷宫(bfs)
两个div在同一行,两个div不换行「建议收藏」
Mathematical analysis_ Notes_ Chapter 10: integral with parameters
ESG Global Leaders Summit | Intel Wang Rui: coping with global climate challenges with the power of science and technology
What is Web3
How to conduct website testing of software testing? Test strategy let's go!
Master the secrets of software security testing methods, and pinch the security test report with your hands
A detailed explanation of head pose estimation [collect good articles]
Intel and Xinbu technology jointly build a machine vision development kit to jointly promote the transformation of industrial intelligence
What about the collapse of win11 playing pubg? Solution to win11 Jedi survival crash
AI landing new question type RPA + AI =?
Nanopineo use development process record
Introduction to namespace Basics
Optimization of channel status offline of other server devices caused by easycvr cluster restart
sscanf,sscanf_ S and its related usage "suggested collection"
A series of shortcut keys for jetbrain pychar
Data security -- 12 -- Analysis of privacy protection
[on automation experience] the growth path of automated testing
Gpt-3 is a peer review online when it has been submitted for its own research
[team learning] [34 sessions] Alibaba cloud Tianchi online programming training camp