Hello,
According the the thread below :
and the slide :
Only when using new EOEditingContext(ERXTaskObjectStoreCoordinatorPool.objectStoreCoordinator()) instead of new EOEditingContext(new EOObjectStoreCoordinator()) will propagate
changes.
("Create a new ObjectStoreCoordinator (use Wonder OSC synchronization if you want changes to propogate)")
So I develop a new thread (for sending mass emails without slowing down all the users as currently)
I used :
a)
I use new EOEditingContext(ERXTaskObjectStoreCoordinatorPool.objectStoreCoordinator()) for the thread
b)
I add the code below each time I want changes to be propagated.
EOEditingContext _editingContextInDefaultEOObjectStore = new EOEditingContext();
_editingContextInDefaultEOObjectStore.invalidateObjectsWithGlobalIDs(new NSArray(new Object[]{ _editingContextInThreadObjectStoreCoordinator().globalIDForObject(_localCampaign) }));
_editingContextInDefaultEOObjectStore.invalidateObjectsWithGlobalIDs(new NSArray(new Object[]{ _editingContextInThreadObjectStoreCoordinator().globalIDForObject(_localCampaign._campagneTask()) }));
try {
_editingContextInDefaultEOObjectStore.saveChanges();
}
catch (Exception e) {
e.printStackTrace();
_editingContextInDefaultEOObjectStore.revert();
}
My task works well, changes are saved in the database…
…but changes are only propagate to the users (in the default EOObjectStore) when the do saveChanges() to their editingContext();
I tried using ERXEC.newEditingContext(ERXTaskObjectStoreCoordinatorPool.objectStoreCoordinator()); without any success.
Any idea where am I wrong ?
Jérémy
|