当前位置:网站首页>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 ;
边栏推荐
- Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
- 【華為機試真題詳解】歡樂的周末
- [12 classic written questions of array and advanced pointer] these questions meet all your illusions about array and pointer, come on!
- NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
- Photoshop plug-in - action related concepts - actions in non loaded execution action files - PS plug-in development
- MySQL----函数
- Reasons and solutions for redis cache penetration and cache avalanche
- Surpass palm! Peking University Master proposed diverse to comprehensively refresh the NLP reasoning ranking
- How to paste the contents copied by the computer into mobaxterm? How to copy and paste
- 超越PaLM!北大碩士提出DiVeRSe,全面刷新NLP推理排行榜
猜你喜欢
Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
Install and configure Jenkins
Super wow fast row, you are worth learning!
PyTorch二分类时BCELoss,CrossEntropyLoss,Sigmoid等的选择和使用
[detailed explanation of Huawei machine test] character statistics and rearrangement
【华为机试真题详解】字符统计及重排
Detailed explanation of QT creator breakpoint debugger
机器学习笔记 - 灰狼优化
社区团购撤城“后遗症”
华为哈勃化身硬科技IPO收割机
随机推荐
How to solve the problem of garbled code when installing dependency through NPM or yarn
Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
Brief introduction of machine learning framework
Huiyuan, 30, is going to have a new owner
Change multiple file names with one click
危机重重下的企业发展,数字化转型到底是不是企业未来救星
Type declaration of all DOM elements in TS
What are CSRF, XSS, SQL injection, DDoS attack and timing attack respectively and how to prevent them (PHP interview theory question)
Implement a blog system -- using template engine technology
机器学习笔记 - 灰狼优化
What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?
Ten billion massage machine blue ocean, difficult to be a giant
【华为机试真题详解】欢乐的周末
Ctfshow web entry command execution
NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读
12 MySQL interview questions that you must chew through to enter Alibaba
Handwriting promise and async await
Cartoon: programmers don't repair computers!
Leetcode: Shortest Word Distance II
Surpass palm! Peking University Master proposed diverse to comprehensively refresh the NLP reasoning ranking