Springboot mybatis集成 Invalid bound statement (not found)....
来源:互联网 发布:开贝抠图软件破解版 编辑:程序博客网 时间:2024/06/01 08:18
使用新技术的时候总会遇到一些很基础的问题,现在又来一个:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.test.shiro.mapper.PermissionMapper.save at org.apache.ibatis.binding.MapperMethod$SqlCommand.<init>(MapperMethod.java:225) ~[mybatis-3.4.5.jar:3.4.5] at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:48) ~[mybatis-3.4.5.jar:3.4.5]..........
这里说是找不到save的实现方法。
首先按照一般解决思路先比对namespace
<mapper namespace="com.test.shiro.mapper.PermissionMapper"> <resultMap id="per" type="com.test.shiro.entity.Permission"> <id column="permissionId" jdbcType="INTEGER" property="permissionId" /> <result column="permission" jdbcType="VARCHAR" property="permission" /> </resultMap> <insert id="save" parameterType="com.test.shiro.entity.Permission" useGeneratedKeys="true" keyProperty="permissionId"> INSERT INTO permission(permissionId,permission) VALUES (#{permissionId},#{permission}) </insert></mapper>
package com.test.shiro.mapper;import com.test.shiro.entity.Permission;import org.apache.ibatis.annotations.Mapper;import org.springframework.stereotype.Service;/** * @author Created by pangkunkun on 2017/11/20. */@Mapper@Servicepublic interface PermissionMapper { /** * 新增权限 * @param permission * */ void save(Permission permission);}
namespace OK,再比对id(即方法名save),这里也是一样的。
还有mapper.xml的路径和名称,对比后发现一切都OK。
后来实在没办法了,跟以前的项目逐一比对,发现application.properties中忘记了mybatise的两行配置:
mybatis.typeAliasesPackage=com.test.shiro.entitymybatis.mapperLocations=classpath:mapper/*.xml
主要是mybatis.mapperLocations=classpath:mapper/*.xml
,加上之后OK了,说白了还是不够熟练,注意的地方过多。
阅读全文
0 0
- springboot 集成mybatis Invalid bound statement (not found)异常
- Springboot mybatis集成 Invalid bound statement (not found)....
- mybatis 异常:Invalid bound statement (not found) .
- mybatis错误: Invalid bound statement (not found)
- MyBatis:Invalid bound statement (not found)
- mybatis错误:Invalid bound statement (not found)
- mybatis BindingException: Invalid bound statement (not found)
- mybatis:Invalid bound statement (not found)
- mybatis: Invalid bound statement (not found)
- mybatis:Invalid bound statement (not found)
- mybatis错误:Invalid bound statement (not found)
- mybatis-- Invalid bound statement (not found)
- Mybatis异常:Invalid bound statement (not found)
- mybatis错误:Invalid bound statement (not found)
- mybatis:Invalid bound statement (not found)
- mybatis错误 Invalid bound statement (not found)
- mybatis Invalid bound statement (not found)
- [MyBatis]Invalid bound statement (not found)错误
- Android 一些网址
- 技术分享连载(五十九)
- 构造函数
- Maven快速入门及应用
- 关于dBm转换为W的技巧
- Springboot mybatis集成 Invalid bound statement (not found)....
- 查看多台机器日志polysh
- 正则表达式匹配
- TensorFlow怎么安装?哪里下载安装包?安装教程、图像识别应用(附安装包/指南)
- 打印两个有序链表的公共部分(每日一道算法题)
- Map.Entry使用详解
- Spring核心框架体系结构
- AX调用.dll
- [leetcode]#108. Convert Sorted Array to Binary Search Tree