MyBatis binding error indicates BindingException:Invalid bound statement of not found solution

  • 2020-06-03 06:20:35
  • OfStack

If present:

org. apache. ibatis. binding. BindingException: Invalid bound statement (not found)

1. The reason is that the definitions of Mapper interface and xml files do not correspond, so we need to check whether the package name, namespace, function name and so on can correspond.

Follow step 11 below:

1. Check whether the package name of the xml file corresponds to the package name 11 corresponding to interface

2. Check whether namespace of xml file corresponds to package name 11 of xml file

3, check whether the name of the function can be corresponding

4. Remove Chinese comments from the xml file

5. Add a space or blank line to xml and save it

Note: When developing with IDEA, if * Mapper.xml does not automatically copy to the mapper class package of the class output directory when packaging, you will need to add the configuration of the mybatis load profile to the pom file!

As follows:


<build>
  <resources>
    <resource>
        <directory>src/main/java</directory>
      <includes>
        <include>**/*.xml</include>
      </includes>
    </resource>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
  </resources>
</build>

Related articles: