InvalidMappingException提示Could not parse mapping document错误的解决方法
转自: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错误的解决方法的更多相关文章
- Win7/Win8 系统下安装Oracle 10g 提示“程序异常终止,发生未知错误”的解决方法
我的Oracle 10g版本是10.2.0.1.0,(10.1同理)选择高级安装,提示“程序异常终止,发生未知错误”. 1.修改Oracle 10G\database\stage\prereq\db\ ...
- nginx提示:500 Internal Server Error错误的解决方法
现在越来越多的站点开始用 Nginx ,("engine x") 是一个高性能的 HTTP 和反向代理服务器,也是一个 IMAP/POP3/SMTP 代理服务器. Nginx 是由 ...
- 【转】nginx提示:500 Internal Server Error错误的解决方法
本文转自:http://www.jb51.net/article/35675.htm 现在越来越多的站点开始用 Nginx ,("engine x") 是一个高性能的 HTTP 和 ...
- linux下mysql提示"mysql deamon failed to start"错误的解决方法
操作系统为centos,网站突然连接不上数据库,于是朋友直接重启了一下服务器.进到cli模式下,执行 service myqsld start 发现还是提示"mysql deamon fai ...
- MySQL之——提示"mysql deamon failed to start"错误的解决方法
网站突然连接不上数据库,于是直接重启了一下服务器.进到cli模式下,执行 service myqsld start 发现还是提示"mysql deamon failed to start&q ...
- 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 ...
- mkdir()提示No such file or directory错误的解决方法
转自:http://www.02405.com/program/php/1692.html 在php中使用mkdir()方法创建文件夹时报错:No such file or directory,出错代 ...
- yii webservice 提示:Procedure 'getSent' not present 错误的解决方法(转)
其实根据常用的webservice清除缓存方法,在client端加入这样一句话: ini_set("soap.wsdl_cache_enabled", "0") ...
- 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 ...
随机推荐
- HTML中的marquee标签实现滚动效果
一.标签<marquee>简介 通过开始标签<marquee>和结束标签</marquee>的共同配合而实现滚动效果,<marquee>滚动的内容< ...
- Activiti流量变量(九)
1什么是流程变量 流程变量在 activiti 中是一个非常重要的角色,流程运转有时需要靠流程变量,业务系统和 activiti结合时少不了流程变量,流程变量就是 activiti 在管理工作流时根据 ...
- 解决报错(Could not create connection to database server.)
org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory 尝试多种方法后发现是由于mysq ...
- 【PowerOJ1741&网络流24题】最长递增子序列问题(最大流)
题意: 思路: [问题分析] 第一问时LIS,动态规划求解,第二问和第三问用网络最大流解决. [建模方法] 首先动态规划求出F[i],表示以第i位为开头的最长上升序列的长度,求出最长上升序列长度K. ...
- mac 外接屏幕切换操作
mac 屏幕小,可外接合适的屏幕扩展.接好屏幕后: 在 mac 系统变化中看到显示器字样, 点击排列,可以看到一个白色的条状色块,即为主屏幕.(镜像显示不能选中) 在 mac 怎么打开一个应用,在其中 ...
- eclipse配置apache tomcat运行时访问路径不需要项目名称
问题:tomcat运行项目默认是要带上项目名的,有时候不想要项目名来访问,如何解决呢? 方法: 1:双击打开tomcat 2:选择Modules,选择你要修改的项目 3:点击Edit,把path修改成 ...
- 走进JavaWeb技术世界14:Mybatis入门
本系列文章将整理到我在GitHub上的<Java面试指南>仓库,更多精彩内容请到我的仓库里查看 https://github.com/h2pl/Java-Tutorial 喜欢的话麻烦点下 ...
- str_shuffle函数
str_shuffle() 函数打乱一个字符串,使用任何一种可能的排序方案. <?php $str = 'hello world '; echo str_shuffle($str); ...
- Redis集合的常用操作指令
Redis集合的常用操作指令 Sets常用操作指令 SADD 将指定的元素添加到集合.如果集合中存在该元素,则忽略. 如果集合不存在,会先创建一个集合然后在添加元素. 127.0.0.1:6379&g ...
- linux之shell脚本
1) 如何向脚本传递参数 ? ./script argument 例子: 显示文件名称脚本 ? 1 2 3 4 ./show.sh file1.txt cat show.sh #!/bin/bash ...