I have 2 PM’s setup. On PM1 I create a Batch entity that contains no Batch.Bills and has a BatchID of -1. I then import the BatchEntity into PM2 which has just been created and has no entities in its cache. The Batch entity still has an ID of -1. I do a bunch of work and now Batch.Bills is not empty. I then build an ArrayList containing Batch, Batch.Bills and import that ArrayList into PM1 with MergeStrategy.OverwriteChanges. When Batch goes into PM1 its BatchID changes from -1 to -2 and all Batch.Bills now reference -2.
1) Why does it switch the ID on me?
2) Can I stop it from switching the ID?
3) How do I get a reference to Batch? I can’t get it by ID because it’s changed. I can’t get it by RowState because PM1 could have any number of new Batch entities.