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 ...
随机推荐
- 【MyBatis】【SQL】删除最快纪录诞生,从一千万条记录中删除八百万条仅用2分6秒
在 https://www.cnblogs.com/xiandedanteng/p/11669629.html 里我做个一个循环按时间查ID并删除之的程序,运行时间是4分7秒. 但是这个程序走了很多次 ...
- angcyo
https://github.com/angcyo https://github.com/angcyo/UIKit https://github.com/angcyo/RHttpServer http ...
- MongoDB in Action (MongoDB 实战).pdf
http://www.open-open.com/doc/view/691d4d2232ce4b30b14c6b218fff4be8
- 小D课堂 - 新版本微服务springcloud+Docker教程_6-03 高级篇幅之zuul常用问题分析
笔记 3.高级篇幅之Zuul常用问题分析和网关过滤器原理分析 简介:讲解Zuul网关原理和过滤器生命周期, 1.路由名称定义问题 路由映射重复覆盖问题 ...
- linux硬件驱动
今天被问到了一个新问题:linux需不需要安装驱动,就像windows装完系统之后需要安装最新驱动一样? 说实话以前真没想过,都是装完系统update一下就直接用了. 谷歌了一下,发现其实也是需要安装 ...
- DevOps - 虚拟环境构建工具Vagrant
1 - Vagrant HomePage: https://www.vagrantup.com/ Download: https://www.vagrantup.com/downloads.html ...
- UEFI+GPT下安装Win10和Ubuntu16.04双系统相关问题(引导、无线连不上网)
1.安装双系统 1)先制作U盘启动,制作过程不再赘述 2)进入bios,设置从U盘启动 3)如下图,选择第二项为安装Ubuntu 4)前几不没什么问题,就直接往下走,选择语言,往下拉有中文选项 5)下 ...
- STS中MyBatis的基本实现
本文采用的是<深浅spring boot 2.x>中第5章的例子,用一个接口实现对一个表项的读取. 数据库:mysql下建立user数据库,表名为t_usr 1. 数据源设置 在appli ...
- SQL介绍、语句之增删改查大全
数据库概念 文件作为数据库,数据格式千差万别 将保存数据的地方统一起来 MySQL一款应用软件 用来帮你操作文件的 只要是基于网络通信,底层都是socket!!! 服务端 -socket通信 -收发消 ...
- 结构体structure
结构体是值类型 import Foundation struct TV{ var keyName="a" var keyNumber=9 func getKey()->Int ...