I'm a little bit confused about the exception handling used with TransactionUtil. Why is TransactionUtil.commit() always executed (its in the finally block)?
If you look at the code below (simplified code snippet of ByConditionFinder.runFind(..)) and imagine a NullPointerException happens inside the //Some code place. Because NullPointerException is not catched, the finally block will execute and the Transaction will commit. Is this what we want? boolean beganTransaction = false; try { beganTransaction = TransactionUtil.begin(); ..//Some code (every exception could occur here) } catch (GenericEntityException t) { TransactionUtil.rollback(beganTransaction, t.getMessage(), t); } finally { TransactionUtil.commit(beganTransaction); } The transaction construct I'm used to (from other projects) is the following: boolean beganTransaction = false; try { beganTransaction = TransactionUtil.begin(); ..//Some code (every exception could occur here) TransactionUtil.commit(beganTransaction); } catch (Throwable t) { TransactionUtil.rollback(beganTransaction, t.getMessage(), t); if (t instanceof Error) { throw (Error)t; } } Michael -- View this message in context: http://www.nabble.com/Exception-Handling-with-TransactionUtil-tf3846106.html#a10892373 Sent from the OFBiz - Dev mailing list archive at Nabble.com.