I've a Parententity that got a ManyValuedAssoc.
The Childentity got an Association to the Parententity.
I've a Form for changing my Parententity. Assigned Childentities are displayed within a Grid using AureliusDataset by providing parents list.
My Form got his own EntityManager using CachedUpdates and BatchSize = 500, that is not attached to the Dataset.
After editing some Properties of my Parententity, I added a new Entity to the List.
I provide Parententity, so that my Association within childentity is set immediatly.
Childentity will not be changed within the grid, but with an own Form.
Saving Childentity will just be done by the following Code using previous named EntityManager.
ObjectManager.SaveOrUpdate(ChildEntity);
At the end, our User has to confirm his changes.
Saving occurs by the following steps:
ObjectManager.SaveOrUpdate(ParentEntity);
ObjectManager.Flush;
ObjectManager.ApplyUpdates;
Aurelius will do the following:
- Add or Update Parententity (both operations are leading to the same error)
- Insert childentity (with ParentId = Parententity.id)
- Update childentity (inc version and set ParentId = Parententity.id)
Step 3. is done by ManyValuedAssoc. But I think it is not necessary at all, because foreign-id of child already points to parent-id.
If I change some values within my created childentity, this leads to an Error...
- Add or Update Parententity (both operations are leading to the same error)
- Insert childentity (with ParentId = Parententity.id)
- Update childentity (inc version and some fieldchanges, ParentId still correct)
- Update childentity (inc version and set ParentId = Parententity.id)
Step 4. leads to an error because my version was incremented by step 3..
Incrementing id by step 3. is fine, because user changes some data.
Maybe you could prevent aurelius from doing Step 4., if corresponding Field already points to the ManyValuedAssocs-Owner.