Fwd: What happen when an object is indexed in several collection?

Hilaire Fernandes hilaire2006 at laposte.net
Fri Apr 6 08:25:29 UTC 2007


Chris Muller a écrit :
> Yes.  If you change any attributes that will affect its index-hash
> calculations in any of the indexes, you must:
> 
>  mySession noteOldKeysFor: theObjectAboutToBeUpdated
> 
> *before* (not after) you update the object.  By "update" I don't mean
> the commit, I mean the actual changing of the instance variables which
> affect its index hash calculations.  This will cause the MagmaSession
> to note the old keys for that object so it can then be moved to the
> new keys upon the next commit.

I use to do that way, because the attributes are changed by the user 
through a seaside component:

IFIDbSession
    commit: [IFIDbSession noteOldKeyFor: learner.
       self call: ((IFILearnerView new)
          school: school;
          learner: learner)]

And basically three indexes are changed: 'firstname' and 'lastname' from 
input user and an 'id' attribute computed as a hash value.

AFAIK, it should be fine, but I am wondering.

Now I am wondering, what is happening if a noteOldKeysFor: is send but 
not attribute is changed? (regarding how I use the noteOldKeysFor:, it 
can happen if the user press the back button of the browser)

Hilaire

> 
> - Chris
> 
> On 4/5/07, Hilaire Fernandes <hilaire2006 at laposte.net> wrote:
>> Is it safe to update an object indexed in several collection ?
>>
>> Hilaire
>>
>> _______________________________________________
>> Magma mailing list
>> Magma at lists.squeakfoundation.org
>> http://lists.squeakfoundation.org/mailman/listinfo/magma
>>



More information about the Magma mailing list