我得到了例外
初始 SessionFactory 创建 failed.org.hibernate.MappingException:来自表 CountryList 的关联引用了未映射的类:com.abegaa.model.StateListPojo
对于这两个 hbm 文件之间的休眠映射
第一个 CountryList 和 StateList
<?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.abegaa.model">
<class name="CountryListPojo" table="CountryList">
<id name="Id" column="Id">
<generator class="increment"></generator>
</id>
<many-to-one name="Db_CountryId" column="Db_CountryId" class="StateListPojo"></many-to-one>
<property name="Db_CountryName" column="Db_CountryName"></property>
</class>
</hibernate-mapping>
和
<?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.abegaa.model">
<class name="StateListPojo" table="StateList">
<id name="Id" column="Id">
<generator class="increment"></generator></id>
<set name="Db_CountryId">
<key column="Db_CountryId"></key>
<one-to-many class="CountryListPojo"/>
</set>
<property name="Db_StateId" column="Db_StateId"/>
<property name="Db_StateName" column="Db_StateName"/>
</class>
</hibernate-mapping>
这是我的课。
public class CountryListPojo
{
private long Id;
private String Db_CountryId;
private String Db_CountryName;
//get and set
}
public class StateListPojo
{
private String Id;
private String Db_CountryId;
private String Db_StateId,Db_StateName;
//get and set
}
我不明白我在哪里做错了?