日常报错记录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 ...
随机推荐
- Attention Model(注意力模型)思想初探
1. Attention model简介 0x1:AM是什么 深度学习里的Attention model其实模拟的是人脑的注意力模型,举个例子来说,当我们观赏一幅画时,虽然我们可以看到整幅画的全貌,但 ...
- Angular记录(5)
文档资料 箭头函数--MDN:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Functions/Arrow_fun ...
- Redux中间件组合方法
中间件 https://redux.js.org/glossary#middleware 中间件在发送端 action端点 和 处理方reducer的端点之间. 主要负责将async action转换 ...
- pandas 使用panel 报错 Panel is deprecated and will be removed in a future version.
Panel is deprecated and will be removed in a future version.The recommended way to represent these t ...
- luogu 1291 概率期望递推
非常好的递推 公式啥的懒得写了,直接放链接哈哈哈https://www.luogu.org/problemnew/solution/P1291 #include<bits/stdc++.h> ...
- Centos7添加新源
yum repolist # 查看yum源列表yum localinstall http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epe ...
- lambda+mutable配合move实现单函数多程序域
主代码 //-----------------------------------说明一的代码 void fun0{ int t = 10; auto loopFun = [=]() mutable{ ...
- js一些格式化
/* 格式化金额 */function formatAmount(s, n) { n = n > 0 && n <= 20 ? n : 2; s = p ...
- java笔试要点(java.sql包)
提供JAVA存取数据库能力的包是 ( ) A: java.sql B: java.awt C: java.lang D: java.swing 解析: A,java.sql包提供Java存取数据库能力 ...
- 实验吧 deeeeeeaaaaaadbeeeeeeeeeef-20
题目描述: 图片是正确的吗? 解题思路: 这道题很有意思,常规的隐写思路没有线索,结果问题出现在照片的分辨率上,tEXtSource iPhone 5的后置摄像头是3264×2448的分辨率,前置摄像 ...