Hi,
Thanks a lot for your response. My "Division" mapping is below -
Code:
<class name="Division" table="DIVISION">
<id name="divisionId" type="java.lang.Long" column="DIVISION_ID"/>
<property name="divisionName" type="java.lang.String"
column="DIVISION_NM" length="50" />
<set name="employees" cascade="all" inverse="false">
<key column="DIVISION_ID" />
<one-to-many class="Employees" />
</class>
public class Division implements Serializable {
long divisionId;
String divisionName;
public Set employees;
getter & setters...
}
The issue I have is when Division is inserted; I dont have the Set of "employees". In my scenario, I need to first insert the Division and at a later point in time, my batch program fetches the Employees objects and this should be inserted into Oracle by Hibernate. But when employees is inserted, need to make sure that Division_Id already exists in the Division table.
Will this scenario work using One to Many or is there any other way out? Please let me know. Thanks.