|
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?
|