Re: multi-instance sync woes
Re: multi-instance sync woes
- Subject: Re: multi-instance sync woes
- From: OC <email@hidden>
- Date: Tue, 25 Nov 2014 23:15:41 +0100
Chuck,
>> ===
>> ... code as above ...
>> if (ocs_is_primary_key_constraint(exception) && adaptorOp.adaptorOperator()==EODatabaseOperation.AdaptorInsertOperator) {
>> NSArray pka=entity.primaryKeyAttributes()
>> EOQualifier pkq=ERXEOAccessUtilities.qualifierFromAttributes(pka,adaptorOp.changedValues()) // contains the PK
>> EOFetchSpecification fs=new EOFetchSpecification(entityName,pkq,null)
>> fs.setRefreshesRefetchedObjects(YES)
>> NSArray objs=ec.objectsWithFetchSpecification(fs)
>> if (objs.count()==1) {
>> // OK, my code does get here, the object inserted by other instance is fetched all right. But what now?!?
>> ???
>> _saveTolerantlyChangesInEC(ec) // let's try again
>> ... ...
>> ===
> Set the relationships for any other objects into the EC to the one fetched, not the one just created and then ec.deleteObject(dupicate object))
Hmmm, there's one weird thing -- sometimes, I get from ec.objectsWithFetchSpecification the VERY SAME object which is in ec.insertedObjects?!?
I've tried to add
ec.fetchTimestamp=System.currentTimeMillis()
but it does not seem to help, still I keep getting the same object in the insertedObjects array AND fetched. If this happens, I am sorta SOL, for
(a) if I do not delete the object, it gets inserted again, and the exception repeats
(b) if I do delete it, not much surprisingly I'm in for a "cannot save changes: Cannot obtain globalId for an object which is not registered in any editingContext".
Now I am investigating what might be the culprit (so far in vain). If you can see a possible reason -- or at least a solution, let me please know.
Thanks,
OC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden