Common causes of invalid bound statement

I often encounter the error org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) when using mybaitis in

development No correspondence requires a more detailed comparison. I often write one or two letters wrong, and I can't find the error for a long time.

Follow the steps below:
1: Check whether the name of the package where the xml file is located corresponds to the interface One-to- one correspondence between package names
2: Check whether the namespace of the xml file corresponds to the package name of the xml file
3: Check whether the function name corresponds to the above
4: Remove the Chinese comments
in the xml file 5: Feel free to add a space to the xml file Or blank line and save
it. If it is spring integration, there is a parameter to pay attention to
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="miscDataSource" />
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<property name="typeAliasesPackage"value="com.share.wm.product.model"></property>
<property name="mapperLocations" value="classpath*:com/share/wm/product/mapper/*Mapper.xml"/>
</bean>

The mapper path in the red classpath above must be consistent with the mapper interface package name you defined. If the package name is inconsistent, the above error will also occur. You and the code find that the Mapper interface is loaded, but the method cannot be loaded, mainly xmlMapperConfiguration The problem of parsing, if you have inconsistent package names, use mybatis-config.xml, and then add the mapper file to the Mappers node

 There is also the dao ending used by your mapper interface definition, but you are configuring *Mapper.xml, which naturally cannot be loaded in this case.

Reference: http://ljhzzyx.blog.163.com/blog/static/38380312201412453629988/

Welcome to join the QQ exchange and learning group 513650703 to exchange and learn together

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326077180&siteId=291194637