Invalid bound statement (not found) with spring and MyBatis integration under MAVEN Engineering: Error

Source: Internet
Author: User

Both Mapper.xml and Mapper.java are present in the project, and the tangent names correspond

I'm used to putting mapper XML and Java in the same directory

On the Internet to see the various methods have failed

1 <?xml version= "1.0" encoding= "UTF-8"?>2 <! DOCTYPE Mapper 3 Public "-//mybatis.org//dtd Mapper 3.0//en"4 "HTTP://MYBATIS.ORG/DTD/MYBATIS-3-MAPPER.DTD" > 5 <mapper namespace= "Mapper" >6     <select id= "finduserbyidmapper" parametertype= "int" Resulttype= "Ssm.po.User" >7         Select *from User where id=#{id}8     </ Select>9 </mapper>

This is changed before the code, the problem is <mapper namespace= "Mapper" > Original mapper Agent developed XML file namespace can not be written, Must use the corresponding Mapper.java of the full path, that is, the CTRL key to go in.

Because the MAVEN build is used, add the following code to the <build></build> tag in Pom.xml

<resources> <resource> <directory>src/main/java</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> <resource> <directory>src/main/re Sources</directory> <includes> <include>**/*.properties</include> <include>**/*.xml</include> </includes> <filtering>false</filtering> </resource> </resources>

Problem Solving!

Invalid bound statement (not found) with spring and MyBatis integration under MAVEN Engineering: Error

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.