Hi,
I am doing an import/export system in order to transfer entities tree from a data base to an other.
First, I retrive entities to export with a fetchEntity with a prefetchPath, then i serialise the top entity into a xml file.
Then, in the destination server, I modify the xml file to make all entities as new. I do the following operations to all entities :
- Set IsNew to True
- Set IsDirty to True
- Set all field IsChanged to True
- Remove all DbValue nodes
- Set all PK and FK to 0
then I deserialise the xml in an entity and I save it.
And my problem comes there : when the prefetchpath used above contains 2 path to the same entity, I noticed this entity is duplicated into the xml (there is NO use of ProcessedObjectReference) and when I save, this entity is twice in the insert queue. For the first, save query is ok, but for the second one, all FK are set to 0 and the save query fails !
Am I doing something wrong ?