Invalid bound statement (not found) 解决思路

1、检查mapping文件




<mapper namespace="com.gold.book.system.dao.BookDao"> 
    
    <resultMap id="bookMap" type="com.gold.book.system.model.Book">  
        <id column="id" property="id"/>
        <id column="name" property="name"/>
    resultMap>
    
    <select id="queryBooks" resultMap="bookMap" parameterType="com.gold.book.system.model.BookDaoQuery"> 
        select
        id,name
        from book
        <where>
            and deleteState = 1
        where>
        ORDER BY updateTime DESC
    select>
mapper>
  1. namespace = dao路径是否正确
  2. resultMap = 返回值(内部字段映射)是否正确
  3. id = dao 方法名 是否正确

2、检查mapping路径

mapping如果不在默认的resource下,需要手动在pom.xml下配置resource,使其能在编译的时候加载。

...
 		<resources>
 			
            <resource>
                <directory>src/main/resourcesdirectory>
                <includes>
                    <include>**/*include>
                includes>
            resource>
            
            <resource>
                <directory>src/main/javadirectory>
                <includes>
                    <include>**/*.xmlinclude>
                includes>
                <filtering>falsefiltering>
            resource>
        resources>
...

3、clean、install

如果上面都正确,请重新clean 编译下。楼主就在执行springTest的时候出现过这个问题,重新变一下就ok了。

你可能感兴趣的:(Java)