我有下面的實體,我不能映射出於某種原因,我得到「org.hibernate.MappingException:未知實體」在運行時休眠org.hibernate.MappingException:未知實體
人:
package abo;
public class Human {
private int id;
private String name;
public Human()
{
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
映射文件Human.hbm.xml(在相同的封裝):
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 16:40:24 26/09/2015 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
<class name="abo.Human" table="human">
<id name="id" type="int">
<generator class="identity" />
</id>
<property name="name" type="java.lang.String">
</property>
</class>
</hibernate-mapping>
現在休眠配置文件(hibernate.cfg.xml中):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="">
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.password">blabla</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.default_schema">protein_tracker</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<mapping resource="abo/Human.hbm.xml"/>
</session-factory>
</hibernate-configuration>
有什麼建議嗎? 謝謝!