转自:http://www.itzhai.com/invalidmappingexception-could-not-parse-mapping-document-prompt-the-wrong-solution.html

org.hibernate.InvalidMappingException: Could not parse mapping document from resource …(错误的xml文件)

出现这样的错误一般是映射文件中映射出错了,找到错误提示resource 后面提示的xml文件,对应POJO对象逐个检查,看是否遗漏了某些属性的配置,或者写错了。

举个例子:
package com.exam.entity;
import java.util.Set;
public class SubjectChapter {
private int chapterId;
private String chapterName;
private Subject subject;
private int chapterNum;
private Set question;
public int getChapterId() {
return chapterId;
}
public void setChapterId(int chapterId) {
this.chapterId = chapterId;
}
public String getChapterName() {
return chapterName;
}
public void setChapterName(String chapterName) {
this.chapterName = chapterName;
}
public Subject getSubject() {
return subject;
}
public void setSubject(Subject subject) {
this.subject = subject;
}
public int getChapterNum() {
return chapterNum;
}
public void setChapterNum(int chapterNum) {
this.chapterNum = chapterNum;
}
public Set getQuestion() {
return question;
}
public void setQuestion(Set question) {
this.question = question;
}
}
<hibernate-mapping package="com.exam.entity">
<class name="SubjectChapter" table="exam_subject_chapter">
<id name="chapterId" column="chapter_id">
<generator class="increment" />
</id>
<property name="chapterName" column="chapter_name"/>
<many-to-one name="subject" column="subject_id" cascade="all"/>
<property name="chapterNum" column="chapter_num"/>
<set name="question" inverse="true">
<key column="subject_chapter_id"/>
<one-to-many class="Question"/>
</set> </class>
</hibernate-mapping>

这里原本少写了chapterNum的映射,导致该错误的出现。

InvalidMappingException提示Could not parse mapping document错误的解决方法的更多相关文章

  1. Win7/Win8 系统下安装Oracle 10g 提示“程序异常终止,发生未知错误”的解决方法

    我的Oracle 10g版本是10.2.0.1.0,(10.1同理)选择高级安装,提示“程序异常终止,发生未知错误”. 1.修改Oracle 10G\database\stage\prereq\db\ ...

  2. nginx提示:500 Internal Server Error错误的解决方法

    现在越来越多的站点开始用 Nginx ,("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 ...

  3. 【转】nginx提示:500 Internal Server Error错误的解决方法

    本文转自:http://www.jb51.net/article/35675.htm 现在越来越多的站点开始用 Nginx ,("engine x") 是一个高性能的 HTTP 和 ...

  4. linux下mysql提示"mysql deamon failed to start"错误的解决方法

    操作系统为centos,网站突然连接不上数据库,于是朋友直接重启了一下服务器.进到cli模式下,执行 service myqsld start 发现还是提示"mysql deamon fai ...

  5. MySQL之——提示"mysql deamon failed to start"错误的解决方法

    网站突然连接不上数据库,于是直接重启了一下服务器.进到cli模式下,执行 service myqsld start 发现还是提示"mysql deamon failed to start&q ...

  6. Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)

    今天配置Spring的xml出现了错误 Multiple annotations found at this line: - schema_reference.4: Failed to read sc ...

  7. mkdir()提示No such file or directory错误的解决方法

    转自:http://www.02405.com/program/php/1692.html 在php中使用mkdir()方法创建文件夹时报错:No such file or directory,出错代 ...

  8. yii webservice 提示:Procedure 'getSent' not present 错误的解决方法(转)

    其实根据常用的webservice清除缓存方法,在client端加入这样一句话: ini_set("soap.wsdl_cache_enabled", "0") ...

  9. org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/domain/book.hbm.xml 联网跑一跑

    org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/domain/boo ...

随机推荐

  1. 基于函数计算 + TensorFlow 的 Serverless AI 推理

    前言概述 本文介绍了使用函数计算部署深度学习 AI 推理的最佳实践, 其中包括使用 FUN 工具一键部署安装第三方依赖.一键部署.本地调试以及压测评估, 全方位展现函数计算的开发敏捷特性.自动弹性伸缩 ...

  2. PHP基础教程 常见PHP错误类型及屏蔽方法

    程序只要在运行,就免不了会出现错误,错误很常见,比如Error,Notice,Warning等等.这篇文章兄弟连PHP培训 小编来跟大家具体说一下PHP的错误类型和屏蔽方法.在 PHP 中,主要有以下 ...

  3. BZOJ 1733: [Usaco2005 feb]Secret Milking Machine 神秘的挤奶机 网络流 + 二分答案

    Description Farmer John is constructing a new milking machine and wishes to keep it secret as long a ...

  4. luogu P1125 笨小猴 x

    P1125 笨小猴 题目描述 笨小猴的词汇量很小,所以每次做英语选择题的时候都很头疼.但是他找到了一种方法,经试验证明,用这种方法去选择选项的时候选对的几率非常大! 这种方法的具体描述如下:假设max ...

  5. 解决Eclipse中文字体横着显示的问题

    Windows ——> Perference——> General ——> Appearence ——> Colors and Fonts ——> Basic ——> ...

  6. APIO2019解题报告

    「APIO 2019」奇怪装置 题目描述 有无限个二元组,每个二元组为\(((t+\left\lfloor\frac{t}{B} \right\rfloor)\%A,t \% B)\),给出一些区间, ...

  7. 5.React中组件通信问题

    1.父组件传递值给子组件 想必这种大家都是知道的吧!都想到了用我们react中的props,那么我在这简单的写了小demo,请看父组件 class Parent extends Component{ ...

  8. xfs格式化、ext4格式化并指定inode区别

    [root@b ~]# mkfs.ext4 -N 90000000 /dev/sdb3 首先是mkfs.xfs的,重点是这几个:     -i size=512  : 默认的值是256KB,这里的设置 ...

  9. vue +ts 在router的路由中import报错的解决方案

    在router.ts中引入.vue文件,会提示打不到module,但是编译可能成功,运行也不报错 找了好久,发现了这个答案 https://segmentfault.com/a/11900000167 ...

  10. easyui表格适应bootstrap

    .panel1 { overflow: hidden; text-align: left; margin:; border:; -moz-border-radius: 0 0 0 0; -webkit ...