Mybatis报错 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding
2018-01-22 16:57
831 查看
Mybatis报错 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'parentCode' not found. Available parameters are [0, 1, param1, param2]
orcal数据库使用mybatis接收参数,如果传的是多个参数,需要使用#{0},#{1},。。。等代替具体参数名,0 代表第一个参数,1 代表第二个参数,以此类推。
错误语句:
正确语句:
orcal数据库使用mybatis接收参数,如果传的是多个参数,需要使用#{0},#{1},。。。等代替具体参数名,0 代表第一个参数,1 代表第二个参数,以此类推。
错误语句:
<select id = "findNameByCode" resultMap="resultMap"> select name,code from table <where> code = #{code} and name = #{name} </where> </select>
正确语句:
<select id = "findNameByCode" resultMap="resultMap"> select name,code from table <where> code = #{0} and name = #{1} </where> </select>
如果需要对参数使用<if>进行判断的话,需要在XXXDAO.java接口层使用@Param注解 : void get(@Param("value") String name); 注: @Param中的参数需要跟 <if test=""> 中的判读参数一致, eg : 使用上面的DAO接口,Mapper中判断 : <if test="value != null and value != ''">
相关文章推荐
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Bi
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingExce
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.B
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingExce
- mybatis异常:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.B
- Spring错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Bi
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [1, 0, param1, param2]
- mybatis 异常 org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding
- Spring+MyBatis 错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.b
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exception 解决办法思考
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.executor.ExecutorEx
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.Persiste
- FAQ(39):org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti
- 关于spring+springMVC+mybatis+maven搭建中的nested exception is org.apache.ibatis.binding.BindingException
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.Reflecti
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderExce
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.builder.BuilderExce