links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Magma Nested Transactions
Last updated at 9:59 pm UTC on 3 November 2006
refactorMe into Magma

Magma allows you to say:
  mySession commit:
    [ ...make some changes...
    mySession commit: [ ...make some other changes... ] ]

The inner-commit actually does nothing; only the outer-commit writes all changes to the db. This is to support the requirement that a bank withdrawal be its own usable operation, a bank deposit be its own usable operation, but also transfer from one account to another (which uses the withdrawal code followed by deposit code) to only be committed wholly. You can just use #commit: in all three methods and it will only consider the outermost commit the one that really commits to the database.