1. Overview
An error is reported after springboot starts the web project
invalid bound statement (not found):xxx
2. Problem analysis
This is a very common exception. Error reporting usually includes the following situations:
2.1 syntax error
Mapper.xml does not correspond to Dao correctly
Java Dao interface
public void delete(@Param("id") String id);
Mapper.xml file corresponding to Java
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="xxx.xxx.xxx.xxDao"> <!-- Delete --> <delete id="delete" parameterType="java.lang.String"> DELETE FROM xxx WHERE id=#{id} </delete> </mapper>
Check and confirm:
a) Whether the interface method name delete is consistent with the id = “delete” in XML
b) Whether the namespace = “XXX. XXX. XXX. Xxxdao” in the XML file is consistent with the path of the interface file (click whether to jump to the corresponding interface class)
c) Whether parametertype and resulttype (resultmap) are accurate
2.2 compilation error
Check whether the corresponding mapper.xml file exists under the project target \ classes \ path
If it does not exist, add it in pom.xml
<build> <resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/resources</directory> <excludes> <exclude>**/*.properties</exclude> <exclude>**/*.xml</exclude> </excludes> <filtering>false</filtering> </resource> </resources> </build>
Recompile and the corresponding XML file will appear (if you want to copy the XML, properties and other configuration files under Src/main/Java to the classes directory, add the above configuration)
two point three Configuration error
There is a problem with the configuration path when specifying the scan package (mybatis. Mapper locations = classpath *:/XX/XX/mapper/*. XML) in the configuration file
Similar Posts:
- [Solved] Mybatis Error: Invalid bound statement (not found)
- MyBatis Error: Error building SqlSession [How to Solve]
- [Solved] Mybatis Error: Invalid bound statement (not found)
- [Solved] Mybatis: the binding mapper cannot be found Error: Org.apache.ibatis.binding.bindingexception: invalid bound statement (not found)
- [Solved] Springboot Project mybatis Error: Invalid bound statement (not found)
- [Solved] Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.
- The project is normal in eclipse, and an error is reported in IDEA [How to Solve]
- [Solved] Could not find resource com/cth/dao/UserImpl.xml & Single mapping file not found
- [Solved] Browser Error: Failed to decode downloaded font and OTS parsing error: Failed to convert *** font to ***
- [Solved] Nested exception is org.apache.ibatis.binding.BindingException: Invalid bound statement (not found):