> RIFE transaction support is available to everything DB-related. 
> By just called inTransaction on a DbQueryManager and providing a  
> TransactionUser, all the DB code that follows (also the GQM and 
> CMF code) will be wrapped in that transaction. It even supports 
> nested structures so that only only transaction will be used if 
> there's already one active.
> 
> More info here:
> http://rifers.org/wiki/display/RIFE/Chainable+transactions

Cool, but pretty confusing if one wants it to return data. The docs are 
inconsistent regarding the necessity of the generic parm "ResultType". 

If I understand the docs and the source code correctly, ...

1) I can use it with GQM's (if the GQM's are within compilation scope) 
    like so:

        final DbQueryManager manager = new DbQueryManager(MyDatasource);

        DbTransactionUser MyTxn = new DbTransactionUser(List<Object> Objs) 
        {
                public void useTransaction() throws InnerClassException
                {
                    Objs.add (GQM_1.doSomething()); 
                    Objs.add (GQM_2.doSomething()); 
                    GQM_1.doSomethingElse();
                }
        };
        try {   manager.inTransaction(MyTxn); 
                // success!
                List<Object> ResultsOfSuccessfulTxn = MyTxn.getData();
        }
        catch (Exception e) { 
                // failed; rolled back 
        }

2) An implicit commit() is performed at the _end_ of the 
    code block if and only if, _within_ the code block, 

    a) no exception is thrown, and 
    b) rollback() is not explicitly called. 

3) Therefore, _all_ DB actions that are to be grouped into a single
   transaction must be grouped within this same single code block.


fred


_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to