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

Source: Internet
Author: User

Tag: path consolidates data Java state with use. SQL SSM

SSH integrated version
<bean id= "Sessionfactory" class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" > <property              Name= "DataSource" ref= "DataSource"/> <property name= "mappingresources" > <list> <value>com/bean/User.hbm.xml</value> </list> </property> <property name= "Hib Ernateproperties "> <props> <prop key=" Hibernate.dialect ">org.hibernate.dialect.mysql5 innodbdialect</prop> <prop key= "Hibernate.show_sql" >true</prop> <prop key= "          Hibernate.hbm2ddl.auto ">update</prop> <prop key=" Hibernate.format_sql ">true</prop> </props> </property> </bean>
Modify the Bean class
Among them, class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" caught my attention, because I used the SPRING4, but here there is 3, and changed it into Class= "Org.springframework.orm.hibernate4.LocalSessionFactoryBean."
SSM Integrated Edition

Environment is jdk1.8 tomcat8 Spring4

    • Item renamed but Pom.xml title part not modified
    • is not in the Pom.xml configuration build contains XML, resulting in the target directory without usermapper.xml
    • Another situation is that the Mapper scan path in the MyBatis configuration file is not configured

Although the Mapper.xml file has been copied to the class directory, but MyBatis is not loaded, the authentication method is to change the DAO or entity class name in Mapper.xml to a nonexistent name. Generally this is not an error. That's mybatis. The mapper file is not loaded.

The solution is to look inside the MyBatis configuration.

Property Name= "Mapperlocations"       value= "Classpath*:com/******/mappers/*mapper.xml" ></property>

is the correct path


I also encountered this problem, just independent with mybatis, not Spring+mybatis, is the registration file order there is a problem

The code has no problems, including namespace, and the Java code is all right

Workaround is

Register all Sqlmap mapping files first

After registering all DAO interface mapper files

For example

   <mappers>          <mapper resource= "Qh/userreg/userreg.sqlmap.xml"/>              <mapper class= " Qh.userreg.IUserRegMapper "/>      </mappers>  

First

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.