Updating an indexed attribute

Chris Muller afunkyobject at yahoo.com
Sun Feb 25 15:51:50 UTC 2007


Hi Hilaire, I recommend avoiding the pattern 

  make some changes
  commit: []

Although it is lucky that this has worked for you (only because refreshPersistentObjectsEvenWhenChangedOnlyByMe defaults to false), it is not how Magma was intended to be used.  

With that pattern, the code is not explicitly revealing about where/which program changes are intended to be captured into the database.  The correct intended pattern is to begin a transaction when you initially open the session (#begin), and then use #commitAndBegin whenever you want to save changes.

The finer-grained patterns allow you to explicitly delineate, in your code, which changes are committed to the database.  Either:

  commit: [ make some changes ]

or

  begin
  make some changes
  commit

Kind Regards,
  Chris


----- Original Message ----
From: Hilaire Fernandes <hilaire2006 at laposte.net>
To: magma at lists.squeakfoundation.org
Sent: Saturday, February 24, 2007 8:33:58 PM
Subject: Updating an indexed attribute

While using noteOldKeyFor:, I noted that using this method and changing
the attribute out of a commit block (and doing a commit: [] latter)
makes the modified attribute not always re-indexed.

When working with Integer attribute (using the MaIntegerIndex), it is ok
to do as above. When using my own MaCompetencyIndex it does not work

I guess it is not the right way to do it that way. So better be careful
to not be too laszy with the commit:[]. I was tempted to do a batch of
changes then conmiting later.

Hilaire

_______________________________________________
Magma mailing list
Magma at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/magma





More information about the Magma mailing list