日常报错记录2: MyBatis:DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.------------ Cause: java.lang.NoSuchMethodException: com.offcn.dao.ShopDao.<init>()
直接上干货:
报错归纳1:
DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.

原因:xml里面不能有java方不存在的类,它是会去找的,找不到就报错,所以,万一删掉java类了,xml里面的相对应映射的字段也要注释掉。遇到两次了!浪费不少时间!
2.MyBatis 他要加空构造 实例化对象

原因:MyBitis ,他实体类pojo class里 要加空构造
3.写法

class 是点,路径是斜杠
4.
xml 控制多级级联查数据库,是可以的,(MyBatis xml作为实现 数据库查询),我这里四级连着查询
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.XXXX.dao.ShopDao"> <!--private int sid; private String sname; private List<Book> blist;--> <resultMap id="resultMap_shop" type="shop"> <id property="sid" column="sid"></id>
<result property="sname" column="sname" ></result> <collection property="blist" ofType="book">
<id property="bid" column="bid"></id>
<result property="bname" column="bname"></result> <association property="user" javaType="user">
<id property="uid" column="uid"></id>
<result property="uname" column="uname"></result>
<result property="password" column="password"></result> <association property="p" javaType="person" >
<id property="pid" column="pid"></id>
<result property="pname" column="pname"></result>
<result property="sex" column="sex"></result>
<result property="birthday" column="birthday"></result>
</association> </association> </collection>
<!-- <association property="blist" javaType=""-->
</resultMap> <!-- List<Shop> getAll(int sid);--> <select id="getAll" parameterType="int" resultMap="resultMap_shop">
select from t_shop s,t_book b,t_user u,t_person p where u.user_person_fk=p.pid and b.book_user_fk=u.uid and s.sid=#{sid} </select> </mapper>
5.
Cause: java.lang.NoSuchMethodException: com.offcn.dao.ShopDao.<init>(),其实是缺少构造,但构造没问题,之后发现是这个写错

日常报错记录2: MyBatis:DEBUG [main] - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.------------ Cause: java.lang.NoSuchMethodException: com.offcn.dao.ShopDao.<init>()的更多相关文章
- 11:12:21.924 [main] DEBUG org.apache.ibatis.logging.LogFactory - Logging initialized using 'class org.apache.ibatis.logging.slf4j.Slf4jImpl' adapter.
11:12:21.924 [main] DEBUG org.apache.ibatis.logging.LogFactory - Logging initialized using 'class or ...
- 日常报错记录4:ssh工程复制粘贴顺序。
今天要复制一个项目. 久久不能如愿. web.xml里面老是有红的,比如applicationContext.xml字段. 它应该是web.xml要找它,于是,我先把applicationContex ...
- java.lang.NoSuchMethodException: cn.pb.bean.Category.<init>()报错
代码如下: package cn.pb.bean; import java.util.ArrayList;import java.util.List; /** * 分类的实体类 */public cl ...
- Spring Boot 报错记录
Spring Boot 报错记录 由于新建的项目没有配置数据库连接启动报错,可以通过取消自动数据源自动配置来解决 解决方案1: @SpringBootApplication(exclude = Dat ...
- 【spring boot Mybatis】报错:org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.interview.dao.UserMapper.add
报错如下: org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.newhope.i ...
- React Native 日常报错
在学习React.js 或 React Native 过程中,有时看着别人的框架或代码,但总是会出现错误,因为React或之中用到的一些包经常更新,有些代码或教程就显得过旧了. 一.日常报错 'con ...
- 报错记录(xml抬头报错)
报错记录(xml抬头报错) Referenced file contains errors (http://www.springframework.org/schema/beans/spring-be ...
- IDEA 报错记录
IDEA 报错记录 Process finished with exit code 0 这种主要是配了默认的 Tomcat ,然后又配置了外部的 Tomcat.解决办法,注释掉默认的: <dep ...
- 【Python】pyinstaller打包运行报错failed to execute script main
前言 最近用pyinstaller打包的时候一直报"failed to execute script main". 最终使用"pyinstaller --hidden-i ...
随机推荐
- IDEA 常用配置
调节代码字体大小 设置:File --- Settings... --- Editor --- General --- 勾选Change font size(Zoom) with Ctrl + Mou ...
- redis connection refused: connect 启动失败
先到redis解压包下执行 ./redis-server redis.conf 再连接 redis-cli
- (三)初探maven之使用IDE
一.在IDE中使用maven 打开Eclipse,在菜单栏依次选中window => preferences => Maven => Installations , 然后添加 ...
- 20155324《网络对抗》Exp2 后门原理与实践
20155324<网络对抗>Exp2 后门原理与实践 20155324<网络对抗>Exp2 后门原理与实践 常用后门工具实践 Windows获得Linux Shell 在Win ...
- Mybatis-Plus入门
1 Mybatis-Plus简介 1.1 什么是Mybatis-Plus MyBatis-Plus(简称 MP)是一个 MyBatis 的增强工具,在 MyBatis 的基础上只做增强不做改变,为简化 ...
- 自定义Maven Archetype模板
1. 目的 自定义Maven Archetype模板目的为了把自己辛苦搭建的基础项目可以作为模板, 方便以后可以快速的创建类似项目,免去每次搭建的麻烦 2.把基础项目打包生成archetype项目 在 ...
- 为什么ArrayList、LinkedList线程不安全,Vector线程安全
ArrayList源码 public boolean add(E e) { ensureCapacityInternal(size + 1); // Increments modCount!! ele ...
- 软件测试面试-必掌握的 Linux常用命令大全--2.0更新版!
- REM方案总结
flexible.js方案 1.设置根元素字体大小为屏幕宽度的十分之一. 2.即根元素字体大小与屏幕宽度的比例为:1/10. jQuery.weui的rem设计方案 1.以屏幕宽度375px为基础,根 ...
- Django学习笔记(二)视图函数
一.url映射 1.为什么回去urls.py文件中找映射? 在‘settings.py’文件中配置了‘ROOT_URLCONF’为‘urls.py’.所有的django回去urls.py中寻找. 2. ...