转自: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. layui jquery ajax,url,type,async,dataType,data

    $.ajax({ url: '/foensys/user/userDelete/'+data[0].id, type:"get", async:true, dataType:&qu ...

  2. class和style绑定

    在数据绑定中,一个常见需求是,将数据与元素的 class 列表,以及元素的 style 内联样式的操作绑定在一起.由于它们都是属性(attribute),因此我们可以使用 v-bind 来处理它们:只 ...

  3. php中如何上传整个文件夹里的所有文件?

    1.使用PHP的创始人 Rasmus Lerdorf 写的APC扩展模块来实现(http://pecl.php.net/package/apc) APC实现方法: 安装APC,参照官方文档安装,可以使 ...

  4. 【bzoj3343】教主的魔法

    *题目描述: 教主最近学会了一种神奇的魔法,能够使人长高.于是他准备演示给XMYZ信息组每个英雄看.于是N个英雄们又一次聚集在了一起,这次他们排成了一列,被编号为1.2.…….N. 每个人的身高一开始 ...

  5. Improving Network Management with Software Defined Networking

    Name of article:Improving Network Management with  Software Defined Networking Origin of the article ...

  6. 大数据笔记(一)——Hadoop的起源与背景知识

    一.大数据的5个特征(IBM提出): Volume(大量) Velocity(高速) Variety(多样) Value(价值) Varacity(真实性) 二.OLTP与OLAP 1.OLTP:联机 ...

  7. FCC成都社区·前端周刊 第 2 期

    01. Propel:JS的科学计算框架 Propel 是一种 JavaScript 科学计算框架,类似于 Python 中的科学计算库 NumPy,也就是说利用 JS 也可以进行机器学习啦.Prop ...

  8. fedora18 [linux]Error: failure: repodata/repomd.xml from fedora: [Errno 256] No more mirrors to try.

    在使用fedora17 系统的yum源的时候出现了如下错误: Error: failure: repodata/repomd.xml from fedora: [Errno 256] No more ...

  9. gsxt滑动验证码

    最后,谈谈滑动验证码. 目前,工商网站已经全面改版,全部采用了滑动验证码,上面绝大多数思路都失效了.对于滑动验证码,网上能搜到的解决方案基本都是下载图片,还原图片,算出滑动距离,然后模拟js来进行拖动 ...

  10. EDM设计案例分享:6款引人入胜的夏日邮件营销模板分享

    夏日酷暑,清凉如风.在这个假期,旅游行业.酒店.服饰等都推出不少的假期活动,吸引游者的到来.假日期间,让我们看看一些旅游业.品牌服装店和酒店是怎么做好电子邮件广告的.在此,Focussend精心为大家 ...