Suppose my root is anArray. Now I load two elements from that array: a := session root at: 1. b := session root at: 2.
Then I mutate both of them. Now I want to commit changes I made to 'a', but not 'b'.
On 11 June 2012 22:26, Chris Muller asqueaker@gmail.com wrote:
Hi Milan, I don't understand -- ...you have a (Magma?) database and you want to commit changes to some of the objects in the database but not all of them? That obviously works so I guess you are asking about something different -- could you please clarify?
On Mon, Jun 11, 2012 at 1:42 PM, Milan Mimica milan.mimica@gmail.com wrote:
Hi
Do I understand correctly that Magma doesn't support commit on per
instance
basis? I want to commit only some of the some instances I have loaded
from
database.
-- Milan Mimica http://sparklet.sf.net
Magma mailing list Magma@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma
Ah ok. Yes, there are actually two ways to do it.
1) you can implement #maTransientVariables on any class to declare its named inst-vars which should be ignored by Magma. Just answer an Array of the inst-var names (it can be calculated dynamically). This is the easiest solution to cause Magma to ignore particular object links.
2) Your example was with Array though, which doesn't have named inst-vars. For that you would have to use a MaImmutabilityStrategy which lets you specify objects to be immutable by a condition block. It can even ignore a reference based on conditions of the *Referencer* (e.g., the referencing object) instead of only the referenced object. See MagmaTestCase>>#commitWithImmutabilityStrategy for usage details.
Hope this helps, Chris
On Tue, Jun 12, 2012 at 1:25 AM, Milan Mimica milan.mimica@gmail.com wrote:
Suppose my root is anArray. Now I load two elements from that array: a := session root at: 1. b := session root at: 2.
Then I mutate both of them. Now I want to commit changes I made to 'a', but not 'b'.
On 11 June 2012 22:26, Chris Muller asqueaker@gmail.com wrote:
Hi Milan, I don't understand -- ...you have a (Magma?) database and you want to commit changes to some of the objects in the database but not all of them? That obviously works so I guess you are asking about something different -- could you please clarify?
On Mon, Jun 11, 2012 at 1:42 PM, Milan Mimica milan.mimica@gmail.com wrote:
Hi
Do I understand correctly that Magma doesn't support commit on per instance basis? I want to commit only some of the some instances I have loaded from database.
-- Milan Mimica http://sparklet.sf.net
Magma mailing list Magma@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/magma
-- Milan Mimica http://sparklet.sf.net
On 12 June 2012 17:20, Chris Muller ma.chris.m@gmail.com wrote:
Ah ok. Yes, there are actually two ways to do it.
- you can implement #maTransientVariables on any class to declare its
named inst-vars which should be ignored by Magma. Just answer an Array of the inst-var names (it can be calculated dynamically). This is the easiest solution to cause Magma to ignore particular object links.
- Your example was with Array though, which doesn't have named
inst-vars. For that you would have to use a MaImmutabilityStrategy which lets you specify objects to be immutable by a condition block. It can even ignore a reference based on conditions of the *Referencer* (e.g., the referencing object) instead of only the referenced object. See MagmaTestCase>>#commitWithImmutabilityStrategy for usage details.
OK, thanks. I knew about #maTransientVariables but haven't thought of using it this way.
magma@lists.squeakfoundation.org