-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: many-to-one issue
PostPosted: Thu Aug 30, 2007 5:16 pm 
Newbie

Joined: Thu Dec 07, 2006 1:02 pm
Posts: 10
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.