Invalid bound statement (not found): com.bookestore.dao.OrderInfoDao.findList的根本原因及解决方案
来源:互联网 发布:制作录音广告软件 编辑:程序博客网 时间:2024/05/23 01:59
Mybatis自定义xml多表查询教程:http://blog.csdn.net/a13432421434/article/details/78369650
描述:利用mybatis逆向工程可以生成单表的增删改查dao层,但能不能根据它的原理,自己去写一个xml来执行多表查询并返回结果呢?在好奇心的驱使下,自己亲自写了一个,其他配置基本没问题,但就是一直报这个错,弄了我两天,终于在一篇文章中找到真正的解决方案(在检查B步骤中),如果确信基本的配置是没问题的,可直接看最后面的检查B步骤;
目标描述:编写一个xml执行sql语句,查询两个关联的表的不同属性的值,得到两个表综合字段的结果集,并返回
首先要保证你的xml以及dao接口的配置等等的正确性(最基本的,重要的是检查B步骤),下面所有标注红色字体的都是必须检查或注意的地方
检查A:
1.利用mybatis逆向工程,applicationContext-mybatis.xml必须的bean配置,如下:
目录:
2.检查dao接口:
MyBatisDao.java(import的包都是mybatis里面的包)
/** * Copyright © 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved. */package com.bookestore.dao;import java.lang.annotation.Documented;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;import org.springframework.stereotype.Component;/** * 标识MyBatis的DAO,方便{@link org.mybatis.spring.mapper.MapperScannerConfigurer}的扫描。 * @author thinkgem * @version 2013-8-28 */@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@Documented@Componentpublic @interface MyBatisDao {/** * The value may indicate a suggestion for a logical component name, * to be turned into a Spring bean in case of an autodetected component. * @return the suggested component name, if any */String value() default "";}
3.检查xml
若检查A都没配置错,那么久要检查以下步骤:
检查B:看看你的工程的pom.xml是否已经配置以下配置?若没有该配置,那么,你写的dao接口和xml就会被漏掉,也就是说,下面的配置就像一个媒婆,给工程介绍这是xml妹妹,没有媒婆,工程不认识茫茫人海的这个xml妹妹,所以就会报Invalid bound statement (not found):错误
<build><!-- 如果不添加此节点mybatis的mapper.xml文件都会被漏掉。 --> <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>
天啊。。。。忽然想起来,,我的哇哈哈还没喝完呢,,,那我先去喝奶咯,各位拜拜。。
阅读全文
0 0
- Invalid bound statement (not found): com.bookestore.dao.OrderInfoDao.findList的根本原因及解决方案
- maven项目报Invalid bound statement (not found): com.**.*解决方案
- Invalid bound statement (not found): com.selectClazzById
- mybaties错误解决Invalid bound statement (not found): com.yealink.example.dao.UserMapper.getUserByUserInf
- Invalid bound statement (not found): com.zc.product.dao.IFancyMapper.totalPage
- mybatis错误:Invalid bound statement (not found): com.prcsteel.peanut.dao.UserDao.selectById
- Invalid bound statement (not found): com.taotao.search.dao.SearchItemDao.getItemList
- 测试spring,mybatis时出现.BindingException: Invalid bound statement (not found): com.imooc.dao.Secki
- Invalid bound statement (not found): com.yu.test.dao.TaskDao.findById
- org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.yj.dao.TrailerA
- mybatis:Invalid bound statement (not found):com.me.dao.UserDAO.insertRecord
- Invalid bound statement (not found):
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- Invalid bound statement (not found)
- openmpi 2.1.1 多网卡运行实例
- iOS编程基础-OC(三)-对象和消息传递
- 51nod 1389 跳跳树 倍增
- 程序运行状态时,代理的回调:
- Python读写文件
- Invalid bound statement (not found): com.bookestore.dao.OrderInfoDao.findList的根本原因及解决方案
- lesson5-1
- dos下遍历目录和文件的代码(主要利用for命令)
- windows32bit安装Redis
- 教你cad版本怎么用转换器转换操作
- 1064. 朋友数(20)——C语言
- 批处理作业调度问题(分支限界法)
- Windows上检出并编译Chromium
- 教程:将WPF控件转化为.dll文件实现控件打包重用