Could not parse mapping document from resource com/hs/model/StudentModel.hbm.xml
网上出现这个问题的
lei.hbm.xml配置写错的,文件头应该改为如下,并不是这个问题
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
也有说
hibernate-mapping package 这里没加包名的.也不是,我加了
<hibernate-mapping package="com.hs.model ">
奇葩问题,在class name上边加上包名解决

类.hbm.xml配置文件结构如下
代码中加粗的地方,最好加上包名,不然容易出奇葩问题
<!-- 映射文件的根节点 -->
<hibernate-mapping >
<!--
对象关系映射的开始:class元素表示类和数据库中的表的映射关系。
name属性指定持久化类(或者接口)的Java全限定名;
table属性指定要映射的对应的数据库表名,如果省略,则以name作为表名
--> <class name="com.hs.model.StudentModel" table="table_student">
<!--
持久化类对象的对象标识符(OID)和表的主键的映射关联:
name属性指定类中作为OID的属性名;
column属性表中主键字段的名字;如果省略,则以name作为字段名
--> <id name="id" column="id">
<!-- 指定对象标识符生成器:class属性指定生成器的类别名 --> </id>
<!-- 普通属性的映射:
name属性:属性的名字,以小写字母开头;
column属性:对应的数据库字段名.如果省略,则以name作为字段名
type属性:指定Hibernate的映射类型、如果省略,则自动匹配
-->
<property name="username" column="username"/>
<property name="password" column="password" />
</class> </hibernate-mapping>
Could not parse mapping document from resource com/hs/model/StudentModel.hbm.xml的更多相关文章
- Could not parse mapping document from resource cn/spt/model/Student.hbm.xml
初始hibernate, 写第一个程序 helloworld的错误: Exception in thread "main" org.hibernate.InvalidMapping ...
- 错误/异常:org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/shore/model/Husband.hbm.xml 的解决方法
1.错误/异常视图 错误/异常描述:无效的映射异常,无法从xxxxx资源中解析映射文档 2.解决方法 出现这个异常,一般情况下是包名写错了.改回来即可. 看报错/异常的第一行,最后面,会提示你 ...
- 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 ...
- Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from resource Caused by: org.hibernate.DuplicateMappingException: duplicate import: Person refers to both cn.itcast.
此错误是说有两个相同的名字的配置文件,所以不知道查找哪个.解决方法就是把不需要的那个配置文件删除. 删除mapping中不需要的那个xml文件即可
- InvalidMappingException提示Could not parse mapping document错误的解决方法
转自:http://www.itzhai.com/invalidmappingexception-could-not-parse-mapping-document-prompt-the-wrong-s ...
- Could not parse mapping document from input stream hibernate配置异常
十二月 , :: 下午 org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context ...
- 关于hibernate总是报错 配置factory的id找不到,mapping配置文件Could not parse mapping document from input stream
Caused by: org.hibernate.InvalidMappingException: Could not parse mapping document from input stream ...
- Could not parse mapping document from input stream
无法从输入流解析映射文档 1.定义的类名或属性名不对,如:*.hbm.xml文件中属性name对应的实体类name不一致.2.xml头文件中"http://www.hibernate.org ...
- org.hibernate.InvalidMappingException: Could not parse mapping document from无法创建sessionFactory
把 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" 改为 "http://hibernate.sourc ...
随机推荐
- 介绍一下再Apache下的Tomcat负载均衡的一些使用问题
在负载均衡技术中,硬件设备是比较昂贵的,对于负载均衡的学习者如果不是在企业中应用或者是学员中学习,很少有机会能碰到实际操作的训练.(http://xz.8682222.com)所以,很多朋友都会选择软 ...
- Django简介以及安装
目录 前言 Web框架本质 服务器和应用程序 基于第三方模块实现Web框架 Python三大主流Web框架 django flask tornado Django框架介绍 安装 创建项目 创建App ...
- SCOI2015
这周各种头疼,一直睡觉+发呆,啥子都没干. 就补一下之前的东西. d1t1小凸玩矩阵 传送门 一开始脑子抽写了最小费用最大流,不知道自己怎么想的. 第k大最小,明显的二分,又是二分图,二分第k大值,把 ...
- iOS之CAGradientLayer属性简介和使用
1.CAGradientLayer简介 CAGradientLayer用于制作背景图层的颜色渐变,也就是颜色梯度!相关属性简介: #import <QuartzCore/CALayer.h> ...
- PAT甲级——A1068 Find More Coins
Eva loves to collect coins from all over the universe, including some other planets like Mars. One d ...
- myeclipse14 破解教程
myeclipse14 破解教程 注意:先不要打开myeclipse,破解完成之后再打开 Myeclipse-2014-GA-破解文件 链接: https://pan.baid ...
- .NET Framework的属性类对控件的支持功能
ToolBoxItem 此属性为类特性.属于工具箱属性,可以设置当前控件是否在工具箱中显示,以及所在工具箱项的类型名称等信息.默认生成的控件都显示在工具箱中. 更多设计时属性介绍: 4.3 属性的 ...
- 08-5-switch
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- osg::BlendFunc来设置透明度
osg::BlendFunc介绍 混合是什么呢?混合就是把两种颜色混在一起.具体一点,就是把某一像素位置原来的颜色和将要画上去的颜色,通过某种方式混在一起,从而实现特殊的效果. 假设我们需要 ...
- watch、tail联合使用
因为用了tmux,不想调整窗格大小,只想输出命令结果的最后几行,所以就想出了这个方法. watch.tail联合用法 watch 'echo "`nvidia-smi`" | ta ...