nested exception is org.apache.ibatis.binding.BindingException
mybatis出错
xml文件:
<update id="decreaseStock">
update item_stock
set
stock = stock - #{amount,jdbcType=INTEGER}
where item_id = #{itemId,jdbcType=INTEGER} and stock >= #{amount,jdbcType=INTEGER}
</update>
DAO接口:
int decreaseStock(@Param("itemId")Integer itemId, @Param("amont")Integer amount);
问题出现在没见标红的注解。
思考:为什么有的有的方法不用加 @Param 注解?举例:int updateByPrimaryKeySelective(ItemStockDO record);
1、不使用@Param注解时,参数只能有一个,当参数超过两个时,要用@Param
转:
实例一 @Param注解单一属性
dao层示例
Public User selectUser(@param(“userName”) String name,@param(“userpassword”) String password);
xml映射对应示例
<select id=" selectUser" resultMap="BaseResultMap">
select * from user_user_t where user_name = #{userName,jdbcType=VARCHAR} and user_password=#{userPassword,jdbcType=VARCHAR}
</select>
注意:采用#{}的方式把@Param注解括号内的参数进行引用(括号内参数对应的是形参如 userName对应的是name);
实例二 @Param注解JavaBean对象
dao层示例
public List<user> getUserInformation(@Param("user") User user);
xml映射对应示例
<select id="getUserInformation" parameterType="com.github.demo.vo.User" resultMap="userMapper">
select
<include refid="User_Base_Column_List" />
from mo_user t where =
<!-- 因为传进来的是对象所以这样写是取不到值得 -->
<if test="user.userName!=null and user.userName!=''"> and t.user_name = #{user.userName} </if>
<if test="user.userAge!=null and user.userAge!=''"> and t.user_age = #{user.userAge} </if>
</select>
nested exception is org.apache.ibatis.binding.BindingException的更多相关文章
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'username' not found. Available parameters are [1, 0, param1, param2]
Spring+mybatis错误:org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.bi ...
- 怪事年年有,今天特别多!org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'empno' not found. Available parameters are [emp, deptno, param1, param
错误: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.Binding ...
- MyBatis 传List参数 nested exception is org.apache.ibatis.binding.BindingException: Parameter 'idList' not found.
在MyBatis传入List参数时,MyBatis报错:nested exception is org.apache.ibatis.binding.BindingException: Paramete ...
- Springboot-001-解决nested exception is org.apache.ibatis.binding.BindingException: Parameter 'env' not found. Available parameters are [arg1, arg0, param1, param2]
环境:Springboot + Mybatis + MySQL + VUE 场景: 前端发出数据比对请求,在服务后台与数据库交互时,接口提示错误信息如下所示: { "code": ...
- Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid b
Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid b ...
- org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'userId' not found. Available parameters are [arg1, arg0, param1, param2]
2018-06-27 16:43:45.552 INFO 16932 --- [nio-8081-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : ...
- spring boot集成mybatis-plus插件进行自定义sql方法开发时报nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):
spring boot集成mybatis-plus插件进行自定义sql方法开发时报nested exception is org.apache.ibatis.binding.BindingExcept ...
- HTTP Status 500 - Request processing failed; nested exception is org.apache.ibatis.binding.BindingException
在使用Maven工程管理工具整合SSM框架时,Mybatis使用逆向工程生成的pojo,mapper接口及映射文件,把mapper接口和映射文件放在DAO工程的同一级src/main/java目录下. ...
- Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement
原因: 此异常的原因是由于mapper接口编译后在同一个目录下没有找到mapper映射文件而出现的.由于maven工程在默认情况下src/main/java目录下的mapper文件是不发布到targe ...
- HTTP Status 500 - Request processing failed; nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)
今天整合ssm框架 时 遇到的问题 困扰我好长时间 原因就是 mapper文件 没有被加载进来 但是 为什么没有被加载进来呢 因为中间的配置文件出了一些问题 网上大多数说法是 在pom ...
随机推荐
- linux如何将某个用户加入到其它组?
答: 在Ubuntu下可以使用以下命令添加: sudo usermod -a -G <group_name> <user_name> 注意: 如何生效呢? 需要重新登陆系统 ...
- ValueAnimator
import android.animation.ValueAnimator; import android.os.Bundle; import android.support.v7.app.AppC ...
- 01 MySQL之数据库基本操作
01-介绍 数据库(DataBase,DB)是一个长期存储在计算机内的.有组织的.有共享的.统一管理的数据集合. 02-基本操作 2.1 创建数据库 # 查看当前所有的数据库 show databas ...
- Java日志体系(一)发展历程
一.日志框架的分类 门面型日志框架: JCL: Apache基金会所属的项目,是一套Java日志接口,之前叫Jakarta Commons Logging,后更名为Commons Logging SL ...
- Java集合(1):Collections工具类中的static方法
与Arrays一样,Collections类中也有一些实用的static方法. (1) 排序操作 reverse(List list):反转指定List集合中元素的顺序 shuffle(List li ...
- loadrunner脚本因为没有token报错
目录 场景 解决过程 解决方案 总结 场景 用loadrunner11录制脚本,处理后回放,加上检查点,报错找不到检查点对应的内容,去掉检查点,没有报错,但是打开页面没有该操作的痕迹.手动在页面上操作 ...
- 产品之我见(2)-求职APP
在求职过程中使用了BOSS直聘.拉钩.领英这三款软件,下面来讲述一下作为求职者身份的使用感受以及遇到的问题. 一.BOSS直聘 手机端:打开首先是标语“互联网招聘神器”的页面 ...
- Hbase标准配置文件 + 增删改查
1.可用配置文件 <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href=&q ...
- 前端H5中JS用FileReader对象读取blob对象二进制数据,文件传输
HTML5中的Blob对象只是二进制数据的容器,本身并不能操作二进制,故本篇将对其操作对象FileReader进行介绍. FileReader FileReader主要用于将文件内容读入内存,通过一系 ...
- Linux三剑客之sed深度实践讲解(下)
2.3.4分组替换 \( \) 和\1的使用说明 echo I am dongdaxia yingxiong. |sed 's#^.*am \([a-z].*\) yin.*$#\1#g' echo ...