Did you try ObjectManager.SaveOrUpdate(longTrendItem)?
A little sidenote on longTrendItem.DiagnosticTypeId. You can make this longTrendItem.DiagnosticType (without the Id) by choosing another (model) name in the datamodeler but keep the name in the database original. Seems more logical to access this field because it is not an Id but another object.
No, I did not try the SaveOrUpdate() method.
I think that in your situation the linked object is saved to the database first and the parent object is probably re-read from the database thus overriding your changes. You can check this with an SQL monitor or WireShark.
If that is the case then update and flush the parent object first. It doesn't make a difference in performance.
FlushSingleObject does not exist but you can add it with this object helper:
TObjectManagerHelper = class helper for TObjectManager
procedure FlushSingleObject(const anObj: TObject);
procedure TObjectManagerHelper.FlushSingleObject(const anObj: TObject);
By the way; yes i think this is a problem with Aurelius. My solution above is just a work-around.
Do you have more details about this problem? What is the mapping you get?
Doesn't TDiagnosticType have a reference back to TLongTrendItem?
No, Only reference from TLongTrendItem to TDiagnosticType.
We confirmed this is a bug in Aurelius introduced in version 2.6.
OK, thanks for the quick reply and fix. I will try the new version tomorrow.