hibernate.cfg.xml的问题

User.hbm.xml文件在src\model\下,运行时出错org.hibernate.MappingException: Could not read mappings from resource: model/User.hbm.xml
1:hibernate.cfg.xml中<mapping resource="model/User.hbm.xml"/>这样写不对吗?
2:会不会是User.hbm.xml中有错误呢?
User.hbm.xml如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/Hibernate-Mapping-3.0.dtd">

<hibernate-mapping>
<class name="model.User" table="user">
<id name="id" column="ID">
<generator class="increment"/>
</id>
<property name="name" column="NAME"/>
<property name="password" column="PASSWORD"/>
</class>
</hibernate-mapping>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping>
<class name="entity.User" table="user" catalog="logistics">
<id name="userId" type="java.lang.Integer">
<column name="user_id" />
<generator class="identity" />
</id>
<property name="userName" type="java.lang.String">
<column name="user_name" length="16" not-null="true" unique="true" />
</property>
<property name="userPassword" type="java.lang.String">
<column name="user_password" length="30" not-null="true" />
</property>
<property name="userGroup" type="java.lang.Integer">
<column name="user_group" not-null="true" />
</property>
</class>
</hibernate-mapping>

//这个是正常的User.hbm.xml。可以对照一下。

在hibernate.cfg.xml中配置的如下
<mapping resource="entity/User.hbm.xml" />简橡源
一定要拦态确定路径名是否正确。
且如庆User.hbm.xml必须放在entity包下
(我的是放在这的,你的要根据你的包名做修改)
应该棚氏是User.hbm.xml这个文件有错误,因为异常报的是链银散不能读取,而不是未找到所以hibernate.cfg.xml中<mapping resource="model/User.hbm.xml"/>这样写应搏袜给没错,你检查一下User.hbm.xml中标签以及头等看看有没有错误。
<class name="model/User" table="user">
改为<class name="model.User"磨判 table="user">
本人的习惯写法:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0/棚游册/EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.ssp.bean">
<class name="User">
<id name="id">
<generator class="native" />
</链宏id>
<property name="name" />
<property name="password" />
</class>
</hibernate-mapping>