I am having a problem saving an object that contains a collection.
Here is the parent mapping file
Code:
// FATIGUE MAPPING
...
...
<bag name="empWaivers" table="EMPLOYEE_WAIVERS" >
<key column="emp_waiver_id"/>
<one-to-many class="EmployeeWaivers"/>
</bag>
...
...
Here is the child mapping file
Code:
// WAIVER MAPPING
...
...
<many-to-one name="fatigue" column="fatigue_id" class="AnnualFatigueReport"/>
...
...
In the code, I am parsing an xml file gathering all the waivers from the file and persisting them to the DB. However, I am running into an issue when I save the parent.
At the time of saving the waiver object, the fatigue object has not been persisted yet, therefore when I go and save the waiver object, my fatigue object is null.
Is there anyway that when I persist my parent object, in this case the Fatigue Object, that hibernate can update my waivers associated to that Fatigue object?
Any help with this would be greatly appreciated