hibernate 出现Could not parse mapping document from resource 报错
2014-10-24 16:53
204 查看
<!-- 映射文件的根节点 -->
<hibernate-mapping >
<!--
对象关系映射的开始:class元素表示类和数据库中的表的映射关系。
name属性指定持久化类(或者接口)的Java全限定名;
table属性指定要映射的对应的数据库表名,如果省略,则以name作为表名
-->
<class name="com.hibernate.customer.customer" table="customer">
<!--
持久化类对象的对象标识符(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>
标红的地方 最好用包的路径名来展示
<hibernate-mapping >
<!--
对象关系映射的开始:class元素表示类和数据库中的表的映射关系。
name属性指定持久化类(或者接口)的Java全限定名;
table属性指定要映射的对应的数据库表名,如果省略,则以name作为表名
-->
<class name="com.hibernate.customer.customer" table="customer">
<!--
持久化类对象的对象标识符(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>
标红的地方 最好用包的路径名来展示
相关文章推荐
- Hibernate 4出现的Could not parse mapping document from resource,Duplicate class/entity mapping
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/**/**.hbm
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource cn/ljt/hiberna
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource *
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource 处理办法
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource 处理办法
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/atguigu/hi
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- eclipse中用Hibernate进行一对多级联报错 Could not parse mapping document from resource oneToMore/Grade.hbm.xml
- 学习hibernate遇到问题之Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/ibeifeng/p
- Hibernate提示 Could not parse mapping document from resource...
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- org.hibernate.InvalidMappingException: Could not parse mapping document from resource
- nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from inp
- Could not parse mapping document from resource com
- 解决InvalidMappingException: Could not parse mapping document from resource问题的办法。