Issue with Version column

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:

  1. Add or Update Parententity (both operations are leading to the same error)
  2. Insert childentity (with ParentId = Parententity.id)
  3. 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...

  1. Add or Update Parententity (both operations are leading to the same error)
  2. Insert childentity (with ParentId = Parententity.id)
  3. Update childentity (inc version and some fieldchanges, ParentId still correct)
  4. 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.

Does everything work fine if you disable CachedUpdates?

Yes, there is no error if CachedUpdates is disabled. But this is not a workaround for me, because it would break my transactionhandling.

Taking a look at SQL-log, I see that, without CachedUpdates, version is incremented before update Mapping Parent-Entity to Child-Entity appears.

But IMHO, no matter if CachedUpdates is enabled or not,
if ChildEntity already points to ParentEntity, you do not need to trigger this statement at all.

Does your feature request solve the issue? Access to ObjectManager.CachedActions.

If not, can you please send a minimal sample project reproducing the issue?

With my feature request I would be able to remove those statements at all, but I would like to avoid manipulating CachedActions as far as possible...

I'll try to create a minimal sample for you

We have received the sample project in a private message. Thank you for it, we reproduced and fixed the issue.
Next TMS Aurelius release will include the fix.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.