Chuck,

On 27. 2. 2015, at 5:51, Chuck Hill <[email protected]> wrote:

>     void validateForSave {
>         super.validateForSave()
>         fixArchivedButReallyUnchangedItemsFromSnapshot() // <=== this is line 
> 980 ===
> 
> “fix” sounds like “change EO object state”.  Note carefully that the name of 
> the method is validateForSave, not 
> validateForSaveAndChangeDataBehindEOFsBack.  EO state should not change 
> during validation.

Hmmm, this might be the culprit.

The trick is, this being my old application, I am saving serialized 
NSDictionaries to BLOBs, and I've found there were *lots* of superfluous 
updates, which I have tracked to the sad fact that serialization (through 
ObjectOutput/InputStream) tends to create different NSDatas from same objects. 
Thus, I've aded essentially this code:

===
    void fixArchivedButReallyUnchangedItemsFromSnapshot {
        NSDictionary ss=this.editingContext().committedSnapshotForObject(this)
        NSDictionary d=this.changesFromSnapshot(ss)
            d.each { String k,v ->
                if (k.hasSuffix('_archivedNSObject')) { // all my BLOB 
attributes have this kind of name
                    def vd=Archivation.objectFromArchivedData(v) // Archivation 
uses ObjectOutput/InputStream to...
                    def ssvd=Archivation.objectFromArchivedData(ss[k]) // 
...turn objects to NSData and back
                    if (vd==ssvd) this.takeValueForKey(ss[k],k)
                }
            }
        }
    }
===

and it did fix those superfluous updates all right... but perhaps it brought 
another problems?

I'll try to move this out from validateForSave, just before saveChanges...

Thanks,
OC


 _______________________________________________
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