当前位置:网站首页>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 ;
边栏推荐
- 危机重重下的企业发展,数字化转型到底是不是企业未来救星
- 用 Go 跑的更快:使用 Golang 为机器学习服务
- Crud de MySQL
- Coding devsecops helps financial enterprises run out of digital acceleration
- CPU design practice - Chapter 4 practice task 3 use pre delivery technology to solve conflicts caused by related issues
- 选择排序和冒泡排序
- js亮瞎你眼的日期选择器
- webRTC SDP mslabel lable
- Ctfshow web entry command execution
- Using tensorboard to visualize the training process in pytoch
猜你喜欢
CODING DevSecOps 助力金融企业跑出数字加速度
Coding devsecops helps financial enterprises run out of digital acceleration
Photoshop plug-in action related concepts actionlist actiondescriptor actionlist action execution load call delete PS plug-in development
Ctfshow web entry command execution
CPU design related notes
Common redis data types and application scenarios
Common MySQL interview questions
Ten billion massage machine blue ocean, difficult to be a giant
1330: [example 8.3] minimum steps
PyTorch二分类时BCELoss,CrossEntropyLoss,Sigmoid等的选择和使用
随机推荐
Shanghai under layoffs
Redis distributed lock principle and its implementation with PHP (1)
ICML 2022 | 探索语言模型的最佳架构和训练方法
CPU设计实战-第四章实践任务二用阻塞技术解决相关引发的冲突
基于TI DRV10970驱动直流无刷电机
30岁汇源,要换新主人了
Change multiple file names with one click
Two Bi development, more than 3000 reports? How to do it?
The elimination strategy of redis
CPU design related notes
maxcompute有没有能查询 表当前存储容量的大小(kb) 的sql?
qt creater断点调试程序详解
CPU design practice - Chapter 4 practice task 3 use pre delivery technology to solve conflicts caused by related issues
The difference between abstract classes and interfaces in PHP (PHP interview theory question)
百亿按摩仪蓝海,难出巨头
Coding devsecops helps financial enterprises run out of digital acceleration
漫画:程序员不是修电脑的!
华为哈勃化身硬科技IPO收割机
Can I pass the PMP Exam in 20 days?
JMeter performance test: serveragent resource monitoring