zoukankan      html  css  js  c++  java
  • MyBatis异常总结

    1 Invalid bound statement

    1 org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): cn.e3mall.search.mapper.ItemMapper.getItemList

    事故现场

    事故原因

    接口和实现类不在同一个目录下面,找不到映射文件导致的。

    此异常的原因是由于 mapper 接口编译后在同一个目录下没有找到 mapper 映射文件而出现的。由于 maven 工程在默
    认情况下 src/main/java 目录下的 mapper 映射文件是不发布到 target 目录下的。

    事故解决

    在 e3-search-service工程的 pom 文件中添加如下内容

    告知在src/main/java和src/main/resources下面都有配置文件。

    <!-- 如果不添加此节点mybatis的mapper.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>
                   <includes>
                       <include>**/*.properties</include>
                       <include>**/*.xml</include>
                   </includes>
                   <filtering>false</filtering>
               </resource>
           </resources>
    </build>
  • 相关阅读:
    2. Add Two Numbers
    8. String to Integer (atoi)
    18. 4Sum
    15. 3Sum
    1. Two Sum
    227. Basic Calculator
    7. Reverse Integer
    PostMessage和SendMessage的区别
    Date Time Picker控件
    git 设置和取消代理
  • 原文地址:https://www.cnblogs.com/jepson6669/p/9147557.html
Copyright © 2011-2022 走看看