Nesting Transactions

Ross Rick <[email protected]>
Newsgroups gmane.comp.java.prevayler
Message-ID <[email protected]>
Hi all,

I wonder if anyone has tried nesting transactions with prevayler before.

To be specific, lets imagine two calls to the same transaction done  
sequentially.

LocalList.add( prevayler.execute ( new GetNutsTransaction( "Walnuts") ;
LocalList.add( prevayler.execute ( new GetNutsTransaction ("Pecans") ;

What I would like to do is make those two calls within the same  
transaction without being forced to code a sort of composite  
transaction.   Of course, what I am really getting at is the ability  
to arbitrarily start a transaction and then have that bundle all of  
the smaller transactions until I explicitly commit.   As a more  
realistic example, I would want to do something like this :

public void increaseNutPurchases(String[] nutTypes, int pctIncrease) {

     Transaction txn = startLongishTransaction();

     try {
         for (String nutType : nutTypes) {

             List growers = prevayler.execute(new  
GetGrowerQuery(nutType));
             for (Grower grower : growers) {

                 prevayler.execute(new  
UpdateBuyQuantityTransaction(grower, pctIncrease));

             }
         }
     }

     catch (Exception e) {
         txn.rollback();
     }
     txn.commit():

}


Has anyone tried this ??   Known issues?   Any red flags pop up for  
you looking at this?

Thx,

Rick

------------------------------------------------------------------------------

_______________________________________________
To unsubscribe go to the end of this page: http://lists.sourceforge.net/lists/listinfo/prevayler-discussion
_______________________________________________
"Databases in Memoriam" -- http://www.prevayler.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.