Solo  当前访客:5 开始使用

Exception:Parameter index out of range (1 > number of parameters, which is 0)


使用mybatis,在mapping中使用了 ''

<if test="e.subjectId>0">
				AND (<![CDATA[ TEACHER.SUBJECT_LINK LIKE CONCAT('%', '#{e.subjectId}','%') ]]>)
			</if>

原因:

不能带有'

 

可能造成该错误的其他原因:

  1、

写like语句的时候 一般都会写成 like '% %'

在mybatis里面写就是应该是 like  '%${name} %' 而不是 '%#{name} %'  

${name} 是不带单引号的,而#{name} 是带单引号的

 

 

 


标题:Exception:Parameter index out of range (1 > number of parameters, which is 0)
作者:hugh0524
地址:https://blog.uproject.cn/articles/2017/01/10/1484020085384.html

, , , , , 0 0