完美解决Invalid bound statement (not found): com.qianfeng.automation.user.mapper.UserDao.insertSe

报错信息

Invalid bound statement (not found): com.qianfeng.automation.user.mapper.AutomationUserDao.insertSective
类似出现上面这个错误时,按以下步骤检查一定就会解决问题:

1,以maven项目为例:xml文件默认需要放在recource目录下或recource目录下的文件夹下。maven默认不会加载java目录下的xml‘文件,如果一定要放在java目录下,需要在pom.xml下修改maven的默认配置。

<!-- 此处是为了方面在java目录中读取xml配置文件  如果不加 默认的只能在resources目录中读取-->
 <resource>
      <directory>src/main/java</directory>
      <includes>
        <include>**/*.xml</include>
        <include>**/*.properties</include>
      </includes>
      <filtering>false</filtering>
    </resource>
    <resource>
      <directory>src/main/resources</directory>
      <includes>
        <include>**/*.xml</include>
        <include>**/*.properties</include>
      </includes>
      <filtering>false</filtering>
    </resource>

2:检查xml文件所在package名称是否和Mapper interface所在的包名对应,如果不希望对应需要在mybatis的配置文件中添加;

//此为在yml或者yaml配置文件中写法,其中mapper是recource目录下存放xml文件的文件夹
mapper-locations: classpath:mapper/*.xml
//此为properties配置文件中的写法
mybatis.mapperLocations=classpath:mapper/*.xml  

3:检查xml的namespace是否和mapper接口全路径名称(包名+类名)对应;

<mapper namespace="com.automation.user.mapper.UserDao">
...
</mapper>

4:检查方法名称和xml文件中标签id是否对应,parameterType参数类型是否正确,返回值类型resultType或者resultMap是否正确;

5:检查数据库表字段的容量大小是否够用,字段多少和实体类字段多少是否一致

6:还不行,重新打包项目或者删除target文件重新运行

收藏加关注,再来不迷路!!!

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值