当前位置:网站首页>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 ;
边栏推荐
- Creation and use of thymeleaf template
- Brief introduction of machine learning framework
- Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
- 我想咨询一下,mysql一个事务对于多张表的更新,怎么保证数据一致性的?
- DVWA range clearance tutorial
- Leetcode: Shortest Word Distance II
- Un week - end heureux
- What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?
- Common redis data types and application scenarios
- [recruitment position] infrastructure software developer
猜你喜欢

计算中间件 Apache Linkis参数解读

Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel

Implement a blog system -- using template engine technology

IPv6与IPv4的区别 网信办等三部推进IPv6规模部署

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

Ten billion massage machine blue ocean, difficult to be a giant

CPU设计相关笔记
![1330: [example 8.3] minimum steps](/img/69/9cb13ac4f47979b498fa2254894ed1.gif)
1330: [example 8.3] minimum steps

Ctfshow web entry explosion

Fr exercise topic - simple question
随机推荐
How can I quickly check whether there is an error after FreeSurfer runs Recon all—— Core command tail redirection
I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
Implement a blog system -- using template engine technology
MySQL之CRUD
MongDB学习笔记
Surpass palm! Peking University Master proposed diverse to comprehensively refresh the NLP reasoning ranking
P6183 [USACO10MAR] The Rock Game S
Your childhood happiness was contracted by it
Microframe technology won the "cloud tripod Award" at the global Cloud Computing Conference!
Ctfshow web entry information collection
Can I pass the PMP Exam in 20 days?
B站做短视频,学抖音死,学YouTube生?
Magic methods and usage in PHP (PHP interview theory questions)
anaconda使用中科大源
js亮瞎你眼的日期选择器
一键更改多个文件名字
Change multiple file names with one click
Want to ask the big guy, is there any synchronization from Tencent cloud Mysql to other places? Binlog saved by Tencent cloud MySQL on cos
Cartoon: programmers don't repair computers!
Where is the operation of convertible bond renewal? Is it safer and more reliable to open an account