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: Autogenerated IDs with master-detail tables
PostPosted: Mon Apr 16, 2007 2:12 pm 
Newbie

Joined: Fri Apr 13, 2007 12:54 pm
Posts: 8
I have the following scenario:

I have a master table and detail tabls. The detail table has the master's PK as a Foreign Key and both tables PKs are auto generated fields.

I'm planning to map the relation between both tables as a cascade="save-update", so how does hibernate work with this?

Does it saves first the master table, retrieves the auto generated Primary Key and then puts that value on each record that is being saved on the detail table?

If this is not correct then do I have to avoid using cascade="save-update" for this scenario and save first the master table, then retrieve the id from the database and then assign it to each of the details objects and finally saving them to the database?


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.