首页 > 其他分享 >Invalid bound statement (not found)的原因以及解决方法

Invalid bound statement (not found)的原因以及解决方法

时间:2024-01-07 21:31:36浏览次数:22  
标签:xml mapper 文件 路径 bound Invalid 接口 statement mybatis

在学习mybatis中,我们总会遇到这个问题,以下有几种解决方式

第一种:查看自己的mapper接口文件与自己的mapper.xml文件是否一致

一致在看namespace中的路径是否正确,namespace要写的是接口的全路径

可以使用 mybatisX插件来看

Invalid bound statement (not found)的原因以及解决方法_配置文件

第二种:查看编译的target文件中是否有mapper,也就是有没有编译上.

可以clear一下,然后package打包.

然后查看pom中是否有配置

<!-- 如果不添加此节点src/main/java目录下的所有配置文件都会被漏掉。 -->
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                    <include>**/*.properties</include>
                    <include>**/*.ini</include>
                </includes>
            </resource>
        </resources>

第三种:去yml配置文件中 去看自己的配置路径

# MyBatis
mybatis:
  # 搜索指定包别名
  typeAliasesPackage: com.zykj.**.domain
  # 配置mapper的扫描,找到所有的mapper.xml映射文件
  mapperLocations: classpath*:mapper/**/*Mapper.xml
  # 加载全局的配置文件
  configLocation: classpath:mybatis/mybatis-config.xml

第三种的路径,包问题

想要在mapper下加入一个文件夹,然后再写xml文件

Invalid bound statement (not found)的原因以及解决方法_java_02

mapper接口与mapper.xml的路径要一致.

这里说一下如何展开包为层级,而不是 com.51cto.domain这种形式,23版idea是三个点,之前版本是一个齿轮.

把这个 compact 前面的对钩去了就行

Invalid bound statement (not found)的原因以及解决方法_xml_03






标签:xml,mapper,文件,路径,bound,Invalid,接口,statement,mybatis
From: https://blog.51cto.com/u_16206682/9135097

相关文章

  • springboot项目中,Mapper接口映射xml文件出错问题,显示Invalid bound statement
    在进行springboot开发过程中遇到的一个问题,显示org.apache.ibatis.binding.BindingException:Invalidboundstatement(notfound);大概意思应该就是找不到Mapper接口对应的xml映射文件,检查了以后,发现应该是没有正确扫描到映射文件的路径。1.保证java文件夹下面的Mapper接口包名称......
  • 高并发下 MySQL Statement Cancellation Timer 的线程数暴涨
    微信公众号:运维开发故事作者:老郑问题描述线上业务高峰期CPU飙升,抓取threaddump发现 MySQLStatementCancellationTimer 的线程数比较多,接收到线上预警,分析一下原因。业务高峰:下面是一些可能相关的信息( mysql驱动,db连接池,orm框架)依赖信息:mysql-jdbc8.0.24druid1.2.8m......
  • knex迁移 - 'ER_INVALID_DEFAULT: 'timestamp'的默认值无效
    在Knex中使用.timestamp()方法时,默认情况下会为该列设置当前时间戳作为默认值。然而,根据你的错误提示,数据库可能不支持此默认值。为了解决这个问题,你可以尝试以下方法:如果你的数据库支持DEFAULTCURRENT_TIMESTAMP,你可以尝试在列定义中添加defaultTo(knex.fn.now(......
  • Uncaught SyntaxError: Invalid or unexpected token
    UncaughtSyntaxError:InvalidorunexpectedtokenJS替换空格发现患者姓名里有空格,导致转JSON的时候,多了"号,在JavaScript中,你可以使用replace()函数来替换字符串中的特定字符或模式。如果你想替换字符串中的空格,你可以这样做:letstr="这是一个含有多个空格的字符串"......
  • Invalid constant value.问题
    Invalidconstantvalue.问题在你的_RecordDay类中,你定义了一个const构造函数:const_RecordDay(this.orientation);但是在build方法中,你使用了这个构造函数:RecordDay(orientation==Orientation.portrait),这里的问题是,你在构造函数中使用了const,但是在实际调用构造函数时,......
  • 无涯教程-Java 正则 - Matcher useAnchoringBounds函数
    java.util.regex.Matcher.useAnchoringBounds(booleanb)方法设置此匹配器的区域边界定位。MatcheruseAnchoringBounds-声明publicMatcheruseAnchoringBounds(booleanb)b  - 指示是否使用锚定边界的布尔值。MatcheruseAnchoringBounds-返回值这个匹配器。M......
  • Mapped Statements collection does not contain value for
    前倾概要:在测试Springabtch分区的过程中,我在本地使用mybatis-plus的时候出现了下面的问题:org.mybatis.spring.MyBatisSystemException:nestedexceptionisorg.apache.ibatis.exceptions.PersistenceException:###Errorqueryingdatabase.Cause:java.lang.IllegalArgumen......
  • 无涯教程-Java 正则 - Matcher boolean hasTransparentBounds()函数
    java.time.Matcher.hasTransparentBounds()方法查询此匹配器的区域边界。booleanhasTransparentBounds()-声明以下是java.time.Matcher.hasTransparentBounds()方法的声明。publicbooleanhasTransparentBounds()booleanhasTransparentBounds()-返回值如果此匹配器......
  • 无涯教程-Java 正则 - Matcher boolean hasAnchoringBounds()函数
    java.time.Matcher.hasAnchoringBounds()方法查询此匹配器的区域边界定位。booleanhasAnchoringBounds()-声明以下是java.time.Matcher.hasAnchoringBounds()方法的声明。publicbooleanhasAnchoringBounds()booleanhasAnchoringBounds()-返回值如果此匹配器使用锚......
  • Predict potential miRNA-disease associations based on bounded nuclear norm regul
    PredictpotentialmiRNA-diseaseassociationsbasedonboundednuclearnormregularization  2023/12/816:00:57PredictingpotentialmiRNA-diseaseassociationsisachallengingtaskinbioinformaticsandcomputationalbiology.Oneapproach......