org.springframework.dao.TransientDataAccessResourceException
今天给大家分析一个在mybatis中遇见的错误

是什么原因导致这个错误信息呢,请看下面代码

再来看看下面找个

发现区别在哪里没有,没错就是#与$的区别。
1 #是将传入的值当做字符串的形式,eg:select id,name,age from student where id =#{id},当前端把id值1,传入到后台的时候,就相当于 select id,name,age from student where id ='1'.
2 $是将传入的数据直接显示生成sql语句,eg:select id,name,age from student where id =${id},当前端把id值1,传入到后台的时候,就相当于 select id,name,age from student where id = 1.
3 使用#可以很大程度上防止sql注入。(语句的拼接)
4 但是如果使用在order by 中就需要使用 $.
5 在大多数情况下还是经常使用#,但在不同情况下必须使用$.
如有需要可以加我Q群【308742428】大家一起讨论技术。
后面会不定时为大家更新文章,敬请期待。
喜欢的朋友可以关注下。
org.springframework.dao.TransientDataAccessResourceException的更多相关文章
- org.springframework.dao.TransientDataAccessResourceException: PreparedStatementCallback.....Parameter index out of range (1 > number of parameters, which is 0).;
sql有误,一般是 sql语句少了问号.
- 【异常】Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationException
Caused by: java.lang.ClassNotFoundException: org.springframework.dao.DataIntegrityViolationException ...
- org.springframework.dao.DataIntegrityViolationException:
数据库用的hibernate,开发工具用的myeclipse,使用开发工具连接数据库生成hibernate基于xml的po类,运行时报org.springframework.dao.DataInteg ...
- javaEE-----org.springframework.dao.InvalidDataAccessApiUsageException: Write operation
org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read ...
- org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [41] did not match expected type [java.lang.Integer (n/a)];
题记:以前记录过一些自己遇到的BUG,这个行为,让我一看报错的提示信息就能定位到问题的所在,后来记得比较多了,好多是重复性的再加上比较忙就没有详细的记录了,今天的工作量比较小,就顺便记录一下,以便以后 ...
- org.springframework.dao.InvalidDataAccessApiUsageException:The given object has a null identifi的解决方案
异常信息: org.springframework.dao.InvalidDataAccessApiUsageException: The given object has a null identi ...
- org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode
[spring]:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowe ...
- OpenSessionInViewFilter与org.springframework.dao.InvalidDataAccessApiUsageException
报错:org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in r ...
- org.springframework.dao.EmptyResultDataAccessException
public Wcrash getWcrashInfo(int id) { String sql = "select plateform_id,android_version,app_ver ...
随机推荐
- centos7 安装php5.6
1.查看centos 版本 lsb_release -a LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-no ...
- cdnbest如何在站点里开启强制缓存
在站点设置中如下图设置: 强制缓存有两种方式,一种是文件类型,一种是url方式
- Selenium WebDriver 对Cookie进行处理绕过登录验证码
首先需要手动登录一次你的测试网站,去Chrome的F12中获取这个网站的cookie信息,找到对应的保存登录信息的cookie,接下来在代码中将上述的cookie信息通过webdriver写入的自动化 ...
- extJs相关名字解释
1.initComponent 初始化部件启动 2.defaults : Object defaults属性可以包含任意个name/value属性对,这些属性将会被添加到每一个元素中...例如, ...
- JavaScript实现观察者模式
首先: 观察者模式是软件设计模式的一种,它
- 20175126《Java程序设计》第一周学习总结
# 学号 20175126 <Java程序设计>第一周学习总结 ## 教材学习内容总结 - 1.安装了WINDOS系统的JDK,并学会了利用JDK编写并编译JAVA程序的基本方法. ...
- Python基础-python基本语法(二)
一.注释 分类:单行注释和多行注释 1.单行注释 单行注释以#开头,在当前行内,#后面的内容就是注释内容 2.多行注释 被两个 ''' 或 '''''' 包括起来的内容就是注释 ...
- Tomcat9报错 The valid characters are defined in RFC 7230 and RFC 3986
tomcat8项目移到tomcat9,出现如下问题 HTTP Status 400 – Bad Request Type Exception Report Message Invalid charac ...
- CSS 样式中的两个方法
在很多时候,我们需要LI开头空一点距离.结尾不能再有下划线了.这个效果在以前是很难实现的.但是有了下面两个选择器,非常容易做出这种东西. .slideTxtBox .bd ul > :first ...
- Pandas plot出图
1.创建一个Series 这是一个线性的数据,我们随机生成1000个数据,Series 默认的 index 就是从0开始的整数,但是这里我显式赋值以便让大家看的更清楚 >>> imp ...