I am new to Hibernate, Trying to join 2 tables one-to-many
BusUnit.java:
public class BusUnit implements Serializable{
private static final long serialVersionUID = 1L;
private
String busUnit;
private String psBusUnit;
private String legalEnt;
private Date startDate;
private Date endDate;
private String lastUpdtUsr;
private Date lastUpdtDt;
private BusUnitDesc busUnitDesc;
.......
BusUnitDesc.java
public class BusUnitDesc implements Serializable{
private static final long serialVersionUID = 1L;
private String busUnit;
private String busUnitDesc;
private Set<BusUnit> busUnits = new HashSet<BusUnit>(0);
BusUnit.hbm.xml:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.common.db.busunit.BusUnit" table="TRSRV_PS_BUS_UNIT">
<composite-id>
<key-property name="legalEnt" column="LEGAL_ENTITY"></key-property>
<key-property name="busUnit" column="BUS_UNIT"></key-property>
<key-property name="startDate" column="START_DT"></key-property>
</composite-id>
<property name="endDate">
<column name="END_DT" />
</property>
<property name="psBusUnit">
<column name="PS_BUS_UNIT"/>
</property>
<property name="lastUpdtUsr">
<column name="LAST_UPDATE_USR_ID"/>
</property>
<property name="lastUpdtDt">
<column name="LAST_UPDATE_TS"/>
</property>
<many-to-one name="busUnitDesc" class="BusUnitDesc">
<column name="PS_BUS_UNIT" not-null="true" />
</many-to-one>
</class>
</hibernate-mapping>
BusUnitDesc.hbm.xml
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN" "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.common.db.busunit.BusUnitDesc" table="TRSRV_PS_BU_DESC">
<id name="busUnit" type="string">
<column name="PS_BUS_UNIT" />
<generator class="assigned" />
</id>
<property name="busUnitDesc">
<column name="PS_BUS_UNIT_DESC" />
</property>
<set name="busUnits" table="TRSRV_PS_BUS_UNIT"
inverse="true" lazy="true">
<key>
<column name="PS_BUS_UNIT"/>
</key>
<one-to-many class="com.common.db.busunit.BusUnit" />
</set>
</class>
</hibernate-mapping>
hibernate.cfg.xml:
....
<mapping resource="resources/com/common/busunit/BusUnit.hbm.xml"/>
<mapping resource="resources/com/common/busunit/BusUnitDesc.hbm.xml"/>
Getting exception while running the following code: sessionFactory = config.buildSessionFactory();
org.hibernate.MappingException: An association from the table TRSRV_PS_BUS_UNIT refers to an unmapped class: BusUnitDesc
Any idea why I am getting it?
Thank you