So I know that when doing programmatic data creation from a SCREEN, when one gets the “During synchronization a new object was found through a relationship that was not marked cascade PERSIST” error, that means one needs to add the objects to the DataContext
.
What happens when one is doing purely programmatic data creation not involving a screen at all, i.e., from a service, and this error happens?
For example I have Patient
entities that have children Address
entities. For performance, I’m using a SaveContext
with setDiscardSaved(true)
. I create the Patient
, add it to the SaveContext
, then create it’s Address
children and add those to the SC.
When I call dataManager.save(saveContext)
- it tries to save the addresses first, thus leading to the above error.
Is there a way around this, while still getting the insanely high performance of 'setDiscardSaved(true)
?