当前位置:网站首页>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
边栏推荐
- 抖音或将推出独立种草社区平台:会不会成为第二个小红书
- Wechat can play the trumpet. Pinduoduo was found guilty of infringement. The shipment of byte VR equipment ranks second in the world. Today, more big news is here
- jvm是什么?jvm调优有哪些目的?
- acwing 843. n-皇后问题
- Digital chemical plant management system based on Virtual Simulation Technology
- 窗口可不是什么便宜的东西
- 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
- 案例大赏:英特尔携众多合作伙伴推动多领域AI产业创新发展
- 广告归因:买量如何做价值衡量?
- EasyCVR平台接入RTMP协议,接口调用提示获取录像错误该如何解决?
猜你喜欢
【线段树实战】最近的请求次数 + 区域和检索 - 数组可修改+我的日程安排表Ⅰ/Ⅲ
AI landing new question type RPA + AI =?
Easycvr cannot be played using webrtc. How to solve it?
How does vscade use the built-in browser?
Why does WordPress open so slowly?
图灵诞辰110周年,智能机器预言成真了吗?
这项15年前的「超前」技术设计,让CPU在AI推理中大放光彩
Digital chemical plant management system based on Virtual Simulation Technology
Ssm+jsp realizes the warehouse management system, and the interface is called an elegant interface
九章云极DataCanvas公司获评36氪「最受投资人关注的硬核科技企业」
随机推荐
Why does WordPress open so slowly?
未婚夫捐5亿美元给女PI,让她不用申请项目,招150位科学家,安心做科研!
Canteen user dish relationship system (C language course design)
Case reward: Intel brings many partners to promote the innovation and development of multi domain AI industry
微信能开小号了,拼多多“砍一刀”被判侵权,字节VR设备出货量全球第二,今日更多大新闻在此
MySQL split method usage
acwing 843. N-queen problem
[team learning] [phase 34] Baidu PaddlePaddle AI talent Creation Camp
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
VM virtual machine operating system not found and NTLDR is missing
Win11图片打不开怎么办?Win11无法打开图片的修复方法
C#使用西门子S7 协议读写PLC DB块
Tiktok may launch an independent grass planting community platform: will it become the second little red book
Win11 control panel shortcut key win11 multiple methods to open the control panel
Meaning of 'n:m' and '1:n' in database design
Practice Guide for interface automation testing (middle): what are the interface testing scenarios
SQL where multiple field filtering
kivy教程之设置窗体大小和背景(教程含源码)
深耕开发者生态,加速AI产业创新发展 英特尔携众多合作伙伴共聚
计数排序基础思路