网上出现这个问题的

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的更多相关文章

  1. Could not parse mapping document from resource cn/spt/model/Student.hbm.xml

    初始hibernate, 写第一个程序 helloworld的错误: Exception in thread "main" org.hibernate.InvalidMapping ...

  2. 错误/异常:org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/shore/model/Husband.hbm.xml 的解决方法

    1.错误/异常视图 错误/异常描述:无效的映射异常,无法从xxxxx资源中解析映射文档 2.解决方法     出现这个异常,一般情况下是包名写错了.改回来即可. 看报错/异常的第一行,最后面,会提示你 ...

  3. 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 ...

  4. 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文件即可

  5. InvalidMappingException提示Could not parse mapping document错误的解决方法

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

  6. Could not parse mapping document from input stream hibernate配置异常

    十二月 , :: 下午 org.apache.catalina.core.StandardContext listenerStart SEVERE: Exception sending context ...

  7. 关于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 ...

  8. Could not parse mapping document from input stream

    无法从输入流解析映射文档 1.定义的类名或属性名不对,如:*.hbm.xml文件中属性name对应的实体类name不一致.2.xml头文件中"http://www.hibernate.org ...

  9. org.hibernate.InvalidMappingException: Could not parse mapping document from无法创建sessionFactory

    把 "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" 改为 "http://hibernate.sourc ...

随机推荐

  1. Tomcat小技巧

    目录 1.项目路径忽略项目名 2.配置tomcat虚拟目录 3.显示目录文件列表 4.设置URL不区分大小写 1.项目路径忽略项目名 server.xml中修改Context标签中的path属性为/ ...

  2. 廖雪峰Java11多线程编程-3高级concurrent包-3Condition

    Condition实现等待和唤醒线程 java.util.locks.ReentrantLock用于替代synchronized加锁 synchronized可以使用wait和notify实现在条件不 ...

  3. COMMENT方法 用于在生成的SQL语句中添加注释内容,

    COMMENT方法 用于在生成的SQL语句中添加注释内容,例如: $this->comment('查询考试前十名分数') ->field('username,score') ->li ...

  4. webpack 清理旧打包资源插件

    当我们修改带hash的文件并进行打包时,每打包一次就会生成一个新的文件,而旧的文件并 没有删除.为了解决这种情况,我们可以使用clean-webpack-plugin 在打包之前将文件先清除,之后再打 ...

  5. laravel框架中使用QueryList插件采集数据

    laravel框架中使用queryList 采集数据 采集数据对我们来说真家常便饭,那么苦苦的写正则采集那么一点点东西,花费了自己大把的时间和精力而且没有一点技术含量,这个时候就是使用我们的好搭档Qu ...

  6. 菜鸟nginx源码剖析数据结构篇(三) 单向链表 ngx_list_t[转]

    菜鸟nginx源码剖析数据结构篇(三) 单向链表 ngx_list_t Author:Echo Chen(陈斌) Email:chenb19870707@gmail.com Blog:Blog.csd ...

  7. redis深入学习(三)-----事务、主从复制、jedis

    reids事务 概念 可以一次执行多个命令,本质是一组命令的集合.一个事务中的所有命令都会序列化,按顺序地串行化执行而不会被其它命令插入,不许加塞 作用 一个队列中,一次性.顺序性.排他性的执行一系列 ...

  8. Git从fork分支开始的过程整理

    文章适用于团队合作的时候多个人向一个repo贡献,整理了Git从fork分支开始的过程. 1. Fork 在github上你要贡献的repo(eg.http://github/remote/test. ...

  9. centos 以太坊多节点私链搭建

    环境  centos 7   搭建 3 个节点的 私链. 第一步 安装 一些依赖的 工具 yum update -y && yum install git wget bzip2 vim ...

  10. CCPC-Wannafly Summer Camp 2019 全记录

    // 7.19-7.29 东北大学秦皇岛校区十天训练营,题目都挂在了Vjudge上.训练期间比较忙,没空更博总结,回来继续补题消化. Day1 这天授课主题是简单图论,节奏挺好,wls两小时理完图论里 ...