当前位置:网站首页>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 ;
边栏推荐
猜你喜欢

社区团购撤城“后遗症”

机器学习笔记 - 灰狼优化

爱可可AI前沿推介(7.5)

MySQL之CRUD

Huiyuan, 30, is going to have a new owner

No one consults when doing research and does not communicate with students. UNC assistant professor has a two-year history of teaching struggle

P1451 求细胞数量/1329:【例8.2】细胞

数据库学习——数据库安全性

NBA赛事直播超清画质背后:阿里云视频云「窄带高清2.0」技术深度解读

12 MySQL interview questions that you must chew through to enter Alibaba
随机推荐
超级哇塞的快排,你值得学会!
Long list optimized virtual scrolling
Stm32+bh1750 photosensitive sensor obtains light intensity
CPU design practice - Chapter 4 practical task 2 using blocking technology to solve conflicts caused by related problems
爱可可AI前沿推介(7.5)
Under the crisis of enterprise development, is digital transformation the future savior of enterprises
想问下大家伙,有无是从腾讯云MYSQL同步到其他地方的呀?腾讯云MySQL存到COS上的binlog
Photoshop插件-动作相关概念-非加载执行动作文件中动作-PS插件开发
[JVM] operation instruction
Stop B makes short videos, learns Tiktok to die, learns YouTube to live?
一键更改多个文件名字
【華為機試真題詳解】歡樂的周末
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
Drive brushless DC motor based on Ti drv10970
长列表优化虚拟滚动
Using tensorboard to visualize the training process in pytoch
在Pytorch中使用Tensorboard可视化训练过程
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
Photoshop plug-in action related concepts actionlist actiondescriptor actionlist action execution load call delete PS plug-in development
How to paste the contents copied by the computer into mobaxterm? How to copy and paste