当前位置:网站首页>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 ;
边栏推荐
- Redis' transaction mechanism
- 浅谈Dataset和Dataloader在加载数据时如何调用到__getitem__()函数
- 【華為機試真題詳解】歡樂的周末
- mapper.xml文件中的注释
- 我想咨询一下,mysql一个事务对于多张表的更新,怎么保证数据一致性的?
- 当代人的水焦虑:好水究竟在哪里?
- Stop B makes short videos, learns Tiktok to die, learns YouTube to live?
- The difference between abstract classes and interfaces in PHP (PHP interview theory question)
- 亿咖通科技通过ISO27001与ISO21434安全管理体系认证
- 你童年的快乐,都是被它承包了
猜你喜欢

B站做短视频,学抖音死,学YouTube生?

Crud de MySQL

两个BI开发,3000多张报表?如何做的到?

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

华为哈勃化身硬科技IPO收割机

Ctfshow web entry command execution

Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发

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

Creation and optimization of MySQL index

百亿按摩仪蓝海,难出巨头
随机推荐
计算中间件 Apache Linkis参数解读
Long list optimized virtual scrolling
选择排序和冒泡排序
How to paste the contents copied by the computer into mobaxterm? How to copy and paste
MySQL之CRUD
美团优选管理层变动:老将刘薇调岗,前阿里高管加盟
市值蒸发超百亿美元,“全球IoT云平台第一股”赴港求生
Photoshop插件-动作相关概念-ActionList-ActionDescriptor-ActionList-动作执行加载调用删除-PS插件开发
Huiyuan, 30, is going to have a new owner
华为哈勃化身硬科技IPO收割机
B站做短视频,学抖音死,学YouTube生?
Photoshop插件-动作相关概念-非加载执行动作文件中动作-PS插件开发
在Pytorch中使用Tensorboard可视化训练过程
Select sort and bubble sort
Implement a blog system -- using template engine technology
Does maxcompute have SQL that can query the current storage capacity (KB) of the table?
There is a powerful and good-looking language bird editor, which is better than typora and developed by Alibaba
Common redis data types and application scenarios
Detailed explanation of usememo, memo, useref and other relevant hooks
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