当前位置:网站首页>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
边栏推荐
- [multi threading exercise] write a multi threading example of the producer consumer model.
- [team learning] [34 sessions] Alibaba cloud Tianchi online programming training camp
- [on automation experience] the growth path of automated testing
- 九章云极DataCanvas公司摘获「第五届数字金融创新大赛」最高荣誉!
- EasyCVR视频广场点击播放时,主菜单高亮效果消失问题的修复
- 赠票速抢|行业大咖纵论软件的质量与效能 QECon大会来啦
- R语言主成分pca、因子分析、聚类对地区经济研究分析重庆市经济指标
- Easycvr cannot be played using webrtc. How to solve it?
- A detailed explanation of head pose estimation [collect good articles]
- Acl2022 | decomposed meta learning small sample named entity recognition
猜你喜欢
Ssm+jsp realizes the warehouse management system, and the interface is called an elegant interface
Deeply cultivate the developer ecosystem, accelerate the innovation and development of AI industry, and Intel brings many partners together
[multi threading exercise] write a multi threading example of the producer consumer model.
Optimization of channel status offline of other server devices caused by easycvr cluster restart
树与图的深度优先遍历模版原理
EasyCVR无法使用WebRTC进行播放,该如何解决?
Basic idea of counting and sorting
This "advanced" technology design 15 years ago makes CPU shine in AI reasoning
Chapter 9 Yunji datacanvas company won the highest honor of the "fifth digital finance innovation competition"!
Digital chemical plants realize the coexistence of advantages of high quality, low cost and fast efficiency
随机推荐
A detailed explanation of head pose estimation [collect good articles]
EasyCVR视频广场点击播放时,主菜单高亮效果消失问题的修复
Is there any way to bookmark the code in the visual studio project- Is there a way to bookmark code in a Visual Studio project?
Lecture 3 of "prime mover x cloud native positive sounding, cost reduction and efficiency enhancement lecture" - kubernetes cluster utilization improvement practice
图灵诞辰110周年,智能机器预言成真了吗?
JetBrain Pycharm的一系列快捷键
Win11截图键无法使用怎么办?Win11截图键无法使用的解决方法
EasyCVR平台接入RTMP协议,接口调用提示获取录像错误该如何解决?
Station B boss used my world to create convolutional neural network, Lecun forwarding! Burst the liver for 6 months, playing more than one million
sscanf,sscanf_s及其相关使用方法「建议收藏」
Nanopineo use development process record
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
论文上岸攻略 | 如何快速入门学术论文写作
英特尔David Tuhy:英特尔傲腾技术成功的原因
leetcode 53. Maximum Subarray 最大子数组和(中等)
In depth analysis of kubebuilder
MySQL forgot how to change the password
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
Win11 control panel shortcut key win11 multiple methods to open the control panel
Some understandings about 01 backpacker