当前位置:网站首页>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 ;
边栏推荐
- I collect multiple Oracle tables at the same time. After collecting for a while, I will report that Oracle's OGA memory is exceeded. Have you encountered it?
- anaconda使用中科大源
- What are the domestic formal futures company platforms in 2022? How about founder metaphase? Is it safe and reliable?
- Where is the operation of convertible bond renewal? Is it safer and more reliable to open an account
- 超级哇塞的快排,你值得学会!
- Mongdb learning notes
- Redis' transaction mechanism
- Under the crisis of enterprise development, is digital transformation the future savior of enterprises
- Cartoon: what are the attributes of a good programmer?
- Reasons and solutions for redis cache penetration and cache avalanche
猜你喜欢
Behind the ultra clear image quality of NBA Live Broadcast: an in-depth interpretation of Alibaba cloud video cloud "narrowband HD 2.0" technology
Surpass palm! Peking University Master proposed diverse to comprehensively refresh the NLP reasoning ranking
Talking about how dataset and dataloader call when loading data__ getitem__ () function
Super wow fast row, you are worth learning!
IPv6与IPv4的区别 网信办等三部推进IPv6规模部署
CPU设计相关笔记
Install and configure Jenkins
数据库学习——数据库安全性
Ctfshow web entry explosion
[detailed explanation of Huawei machine test] character statistics and rearrangement
随机推荐
Stm32+bh1750 photosensitive sensor obtains light intensity
Brief introduction of machine learning framework
可转债打新在哪里操作开户是更安全可靠的呢
裁员下的上海
Reasons and solutions for redis cache penetration and cache avalanche
浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数
How to solve the problem of garbled code when installing dependency through NPM or yarn
[C question set] of Ⅷ
Interview shock 62: what are the precautions for group by?
Change multiple file names with one click
30岁汇源,要换新主人了
sql server学习笔记
Photoshop plug-in - action related concepts - actions in non loaded execution action files - PS plug-in development
Reconnaissance des caractères easycr
webRTC SDP mslabel lable
12 MySQL interview questions that you must chew through to enter Alibaba
Long list optimized virtual scrolling
Visual task scheduling & drag and drop | scalph data integration based on Apache seatunnel
I want to inquire about how to ensure data consistency when a MySQL transaction updates multiple tables?
超越PaLM!北大碩士提出DiVeRSe,全面刷新NLP推理排行榜