当前位置:网站首页>mapper. Comments in XML files
mapper. Comments in XML files
2022-07-05 15:09:00 【Blue sky ⊙ white clouds】
mapper.xml Notes in the document
Annotation mode
stay mapper.xml In file , The annotation method is <!--existence of query content-->, Direct adoption Java Comments of code way /*existence of query content*/ Will report a mistake , Especially in SQL sentence When this annotation method appears in .
‘ Invalid column index ’bug And solve
You need to verify the data when importing data yesterday , stay mapper Query the data in the table in the file , Will be voided sql Select Java The way , Error will be reported at this time .
<select id="getSeqNameCount" parameterClass="java.util.HashMap" resultClass="java.lang.Integer">
SELECT COUNT(*) COUN FROM tablename A
WHERE A.id=#id# and A.name=#name#
/*SELECT * FROM tablename A WHERE A.id=#id# and A.name=#name#*/
</select>
During parsing, the parameter position will be parsed as a placeholder ‘?’, So now the following sql It will be parsed in the background as follows , But there are only two parameters passed in , So I will report at this time “Caused by: java.sql.SQLException: Invalid column index ”, Because the number of parameters and placeholders passed in varies .
SELECT COUNT(*) COUN FROM tablename A WHERE A.id=? and A.name=?
/*SELECT * FROM tablename A WHERE A.id=? and A.name=?/
summary
1、mapper.xml The annotation method in the document is <!--existence of query content-->;
2、 “Caused by: java.sql.SQLException: Invalid column index ” Errors are generally caused by sql Placeholders in statements cause :
1 The number of incoming parameters is different from the number of placeholders ;
2SQL Placeholders in statements ? It's the Chinese version ;
3SQL Placeholders in statements ? Put in a string ;
边栏推荐
- Talking about how dataset and dataloader call when loading data__ getitem__ () function
- 想问下大家伙,有无是从腾讯云MYSQL同步到其他地方的呀?腾讯云MySQL存到COS上的binlog
- Interpretation of Apache linkage parameters in computing middleware
- Coding devsecops helps financial enterprises run out of digital acceleration
- Huiyuan, 30, is going to have a new owner
- 浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数
- sql server char nchar varchar和nvarchar的区别
- NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
- 长列表优化虚拟滚动
- Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
猜你喜欢
![1330: [example 8.3] minimum steps](/img/69/9cb13ac4f47979b498fa2254894ed1.gif)
1330: [example 8.3] minimum steps

面试突击62:group by 有哪些注意事项?

"Sequelae" of the withdrawal of community group purchase from the city

Microframe technology won the "cloud tripod Award" at the global Cloud Computing Conference!

做研究无人咨询、与学生不交心,UNC助理教授两年教职挣扎史
![[JVM] operation instruction](/img/f5/85580495474ef58eafbb421338e93f.png)
[JVM] operation instruction

CPU设计相关笔记

选择排序和冒泡排序

Common MySQL interview questions

CPU design related notes
随机推荐
Calculate weight and comprehensive score by R entropy weight method
How to solve the problem of garbled code when installing dependency through NPM or yarn
Ctfshow web entry explosion
webRTC SDP mslabel lable
Ten billion massage machine blue ocean, difficult to be a giant
我想咨询一下,mysql一个事务对于多张表的更新,怎么保证数据一致性的?
MySQL----函数
Using tensorboard to visualize the training process in pytoch
P1451 calculate the number of cells / 1329: [example 8.2] cells
面试突击62:group by 有哪些注意事项?
机器学习框架简述
手写promise与async await
TS所有dom元素的类型声明
CPU设计实战-第四章实践任务二用阻塞技术解决相关引发的冲突
qt creater断点调试程序详解
百亿按摩仪蓝海,难出巨头
js亮瞎你眼的日期选择器
IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
Two Bi development, more than 3000 reports? How to do it?
Dark horse programmer - software testing -10 stage 2-linux and database -44-57 why learn database, description of database classification relational database, description of Navicat operation data, de