New Master & Detail Records with Navigators

Posts   
 
    
mirco89
User
Posts: 7
Joined: 28-Mar-2013
# Posted on: 28-Mar-2013 14:54:17   

Hi all.

I need to manage 2 set of data structured in a Master&Detail relation (2 masters with their 2 related details). I have 2 Entity Collections master. In the single entity of this masters are loaded the detail entity in the respectively navigators, if needed.

I have to copy from the Master source A to Master destination B one or more record. Consequently I have to copy also the related details. I create the new entity for the master (creating a new entity and valorising it with the value of the master source). After that I create the new detail entities and I add them on the navigator of the master.

If I save the entity collection I get an exception: I cannot insert ID null on the foreign key of the detail record (id referring to the master). The fk_idMaster is rightly null because the master entity not yet been created. I thought / hoped that, belong to the navigator, the foreign keys of the details were automatically populated when saving with recurse set to true.

What am I doing wrong? There is a solution more conveniently?

Thanks and regards Mirco

mirco89
User
Posts: 7
Joined: 28-Mar-2013
# Posted on: 28-Mar-2013 17:28:33   

Sorry, I've resolved: we don't usually use the navigators, I had re-added it only in the master record but doing some tests I saw that only by inserting it also in detail it works.