selective commit

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

selective commit

mmimica
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
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/magma
Reply | Threaded
Open this post in threaded view
|

Re: selective commit

mmimica
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 <[hidden email]> 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 <[hidden email]> 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
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/magma
>



--
Milan Mimica
http://sparklet.sf.net

_______________________________________________
Magma mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/magma
Reply | Threaded
Open this post in threaded view
|

Re: selective commit

Chris Muller-4
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]>
>> 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
>> > [hidden email]
>> > http://lists.squeakfoundation.org/mailman/listinfo/magma
>> >
>
>
>
>
> --
> Milan Mimica
> http://sparklet.sf.net
_______________________________________________
Magma mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/magma
Reply | Threaded
Open this post in threaded view
|

Re: selective commit

mmimica
On 12 June 2012 17:20, Chris Muller <[hidden email]> wrote:
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.

OK, thanks. I knew about  #maTransientVariables but haven't thought of using it this way.


--
Milan Mimica
http://sparklet.sf.net

_______________________________________________
Magma mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/magma