A couple of things that stand out for me… First, why are you expecting the object to be deleted when you just remove it from the relationship?
Second, have you removed calls to lock() and unlock(), or are you not calling them? Ken > On Feb 25, 2015, at 7:07 PM, OC <o...@ocs.cz> wrote: > > Hello there, > > I've bumped into rather a weird (at least to me) behaviour. Is this normal > and am I just overlooking something by expecting it to work? > > I've noticed lately that my background tasks (each of which uses its own EC) > stopped to delete old objects. Pursuing the culprit, I have found that it > began when I (by Ramsey's advice) stopped moving objects betwixt those ECs > using localInstanceIn, replacing it by explicit globalID-based creation > (only, by Chuck's advice, I am using faultForGlobalID instead of > ERXEOGlobalIDUtilities.fetchObjectWithGlobalID). > > I am able to repeat the problem e.g., this way: > > === launched very early in Application, no session/component created yet === > def ec=ERXEC.newEditingContext() > def auction=EOUtilities.objectWithPrimaryKeyValue(ec,'DBAuction',1000003) > def records=auction.importedRecords() > println "owning rel: > ${auction.ownsDestinationObjectsForRelationshipKey('importedRecords')} > inverse '${auction.inverseForRelationshipKey('importedRecords')}' > #$records.count" // just to make sure it's all right > def lr=records.lastObject() > println "-- in 'default' EC removing $lr from $auction..." > lr.removeObjectFromBothSidesOfRelationshipWithKey(auction,'auction') > auction.editingContext().saveChanges() // my delegate logs out all adaptor > ops: this does delete all right > > def ec2=ERXEC.newEditingContext(new EOObjectStoreCoordinator()) > auction=ec2.faultForGlobalID(auction.permanentGlobalID(),ec2) // this is how > I 'move' objects to background tasks... > lr=ec2.faultForGlobalID(records.lastObject().permanentGlobalID(),ec2) // ... > is it indeed the right way? > println "-- in EC in extra OSC removing $lr from $auction..." > lr.removeObjectFromBothSidesOfRelationshipWithKey(auction,'auction') > auction.editingContext().saveChanges() // for this one DOES NOT delete, see > the logs below! > === > > This code -- along with the logs in > databaseContextWillPerformAdaptorOperations -- prints out this: > > === > owning rel: true inverse 'auction' #2 > -- in 'default' EC removing <DBRecord@1532707037 PK:1004656 /EC:829232957> > from <DBAuction@357286753 PK:1000003 /EC:829232957>... > - 1: DELETE on 'DBRecord' (uid = 1004656) > -- in EC in extra OSC removing <DBRecord@2038388710 PK:1004657 /EC:489384291> > from <DBAuction@325329592 PK:1000003 /EC:489384291>... > - 1: UPDATE on 'DBRecord' (uid = 1004657) > 1{auction_id:<com.webobjects.foundation.NSKeyValueCoding$Null>} > === > > Does it make any sense? > > Note: if I replace the 'lr.removeObjectFromBothSidesOfRelationshipWithKey' by > ec2.deleteObject(lr), it works all right, deleting the record in both cases. > > Thanks, > OC > > > > > > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/webobjects-dev/kenlists%40anderhome.com > > This email sent to kenli...@anderhome.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com