Chuck,

On 28. 2. 2015, at 19:54, Chuck Hill <[email protected]> wrote:

>> But. It being the week end and me having at least some time free, I've 
>> played with the thing further. I've found that the GIDs are _not_ the 
>> culprit actually; the problem happens with localInstancesIn just as well -- 
>> _presumed I call changesFromCommittedSnapshot_[*]. Triple Wow.
> 
> Ah, Schrödinger’s EOF. :-P  Observing some things can materially change the 
> state of EOF.   Calling this method calls ec.committedSnapshotForObject() 
> which causes the EC to record the committed snapshot for the object at that 
> point in time.  Normally this is done only at the point the EO first changes.

Aha, I see; it even makes some sense :)

What does not make any sense (to me at least) is that

(a) when the committed snapshot is NOT recorded, the owning relationship does 
what is expected, deleting the object,
(b) when it IS recorded, it does not delete the object, just NULLs its FK to 
the auction, as if it was not owning at all?

(Well, it's rather academic question now -- thanks to Bogdan, Stefan and 
Theodore I've got to the gold mine of information, incl. your “Optimization: 
EOF and beyond”, one of results of which is that I'll pretty soon re-write the 
deletion code to ERXEOAccessUtilities.deleteRows... anyway :P)

Thanks and all the best,
OC

> The following code:
> 
> ===
>         def ec=ERXEC.newEditingContext(),ec2=ERXEC.newEditingContext()
>         ec.lock(); ec2.lock() // pbbly superfluous, but you said this 
> prevents lots of hidden surprises :)
>         def eo=EOUtilities.objectWithPrimaryKeyValue(ec,'DBAuction',1000004)
>         def records=eo.importedRecords()
>         def r1=records[0],r2=records[1]
>         r1.removeObjectFromBothSidesOfRelationshipWithKey(eo,'auction')
>         ec.saveChanges()
>         def eo2=eo.localInstanceIn(ec2),r22=r2.localInstanceIn(ec2)
>         //eo2.changesFromCommittedSnapshot() // WHAT THE?!?
>         r22.removeObjectFromBothSidesOfRelationshipWithKey(eo2,'auction')
>         ec2.saveChanges()
> ===
> 
> works properly, i.e., it DELETEs twice. As soon as I remove the comment-out 
> at the WHAT THE line, i.e., as soon as "eo2.changesFromCommittedSnapshot()" 
> gets called, I get DELETE/UPDATE (to null). Comment the line out again, two 
> DELETEs are back.
> 
> This gets curiouser and curiouser.
> 
> Do you have any idea what the b. H. happens there? Or at least, what would 
> you recommend I should try now, so that the culprit is found?
> 
> Thanks and all the best,
> OC
> 
> [*] What mislead me were my overridden toString's, in which I use 
> changesFromCommittedSnapshot to print out the edited state.
> 
> 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to