当前位置:网站首页>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 ;
边栏推荐
- IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
- CPU design related notes
- 漫画:优秀的程序员具备哪些属性?
- 安装配置Jenkins
- 百亿按摩仪蓝海,难出巨头
- GPS原始坐标转百度地图坐标(纯C代码)
- Interview shock 62: what are the precautions for group by?
- Au - delà du PARM! La maîtrise de l'Université de Pékin propose diverse pour actualiser complètement le classement du raisonnement du NLP
- Magic methods and usage in PHP (PHP interview theory questions)
- 1330: [example 8.3] minimum steps
猜你喜欢

浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数

How to paste the contents copied by the computer into mobaxterm? How to copy and paste

MySQL之CRUD

危机重重下的企业发展,数字化转型到底是不是企业未来救星

Interview shock 62: what are the precautions for group by?

Coding devsecops helps financial enterprises run out of digital acceleration

CPU design related notes

Fr exercise topic --- comprehensive question

Run faster with go: use golang to serve machine learning

【数组和进阶指针经典笔试题12道】这些题,满足你对数组和指针的所有幻想,come on !
随机推荐
Reconnaissance des caractères easycr
[JVM] operation instruction
Mysql---- function
Stop B makes short videos, learns Tiktok to die, learns YouTube to live?
【数组和进阶指针经典笔试题12道】这些题,满足你对数组和指针的所有幻想,come on !
JMeter performance test: serveragent resource monitoring
CPU设计相关笔记
漫画:优秀的程序员具备哪些属性?
Common redis data types and application scenarios
What are CSRF, XSS, SQL injection, DDoS attack and timing attack respectively and how to prevent them (PHP interview theory question)
Cartoon: what are the attributes of a good programmer?
Calculate weight and comprehensive score by R entropy weight method
There is a powerful and good-looking language bird editor, which is better than typora and developed by Alibaba
Interpretation of Apache linkage parameters in computing middleware
数据库学习——数据库安全性
Install and configure Jenkins
PHP high concurrency and large traffic solution (PHP interview theory question)
Cartoon: programmers don't repair computers!
Differences between IPv6 and IPv4 three departments including the office of network information technology promote IPv6 scale deployment
Common interview questions about swoole