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 ...
随机推荐
- Python3基础笔记_元组
# Python3 元组 ''' Python 的元组与列表类似,不同之处在于元组的元素不能修改. 元组使用小括号,列表使用方括号. 元组中只包含一个元素时,需要在元素后面添加逗号,否则括号会被当作运 ...
- 0819NOIP模拟测试赛后总结
这次挂得很悲伤. T1.T3我都想到正解了…… 结果T1少看了个条件:20%保证ai互不相等.以为100%…… 然后挂到了20分,赛后加了个set不到1分钟就A掉了.. T2把分骗满跑路. T3sb线 ...
- 洛谷P4550 【收集邮票】
题目链接: 神仙题QAQ 题目分析: 概率期望题是不可能会的,一辈子都不可能会的QAQ 这个题也太仙了 首先明确一下题意里面我感觉没太说清楚的地方,这里是抽到第\(i\)次要\(i\)元钱,不是抽到第 ...
- opencv-阈值分割
关于自适应阈值,可参考:Wellner 自适应阈值二值化算法 一.大津法OTSU(最大类间方差法) 参考:非黑即白——图像分割入门篇之Otsu阈值 自适应阈值分割—大津法(OTSU算法)C++实现 灰 ...
- Error-IDEA:“Import from external model” 与 “Create from existing source”的区别
ylbtech-Error-IDEA:“Import from external model” 与 “Create from existing source”的区别 1.返回顶部 1. “Import ...
- JVM系列(四)— 原子性、可见性与有序性
上一篇讲了Java内存模型的相关知识,模型设计正是围绕着并发过程中如何处理原子性,可见性和有序性这3个特征来建立的 一.原子性(Atomicity) 原子性的概念无需多说,熟悉事物的4个特性的应该比较 ...
- Free- Linux必学的60个命令
1.作用 free命令用来显示内存的使用情况,使用权限是所有用户. 2.格式 free [-b|-k|-m] [-o] [-s delay] [-t] [-V] 3.主要参数 -b -k -m:分别以 ...
- Leetcode962. Maximum Width最大宽度坡 Ramp
给定一个整数数组 A,坡是元组 (i, j),其中 i < j 且 A[i] <= A[j].这样的坡的宽度为 j - i. 找出 A 中的坡的最大宽度,如果不存在,返回 0 . 示例 ...
- [转]一分钟明白 VS manifest 原理
什么是vs 程序的manifest文件 manifest 是VS程序用来标明所依赖的side-by-side组建,如ATL, CRT等的清单. 为什么要有manifest文件 一台pc上,用一组建往往 ...
- Delphi 设计模式:《HeadFirst设计模式》Delphi7代码---观察者模式之WeatherReport[转]
1 2{<HeadFirst设计模式>之观察者模式 } 3{ 主题与观察者 } 4{ 编译工具 :Delphi7.0 ...