public V call() { boolean success = false; ConfStoreDAOConnection conn = getConnection(); try { if (_txm!=null) _txm.begin(); V r = call(conn); if (_txm!=null) _txm.commit(); success = true; return r; } catch (Exception e){ e.printStackTrace(); __log.error("TxError",e); return null; } finally { if (!success && _txm != null) try { _txm.rollback(); } catch (Exception ex) { __log.error("DbError", ex); } conn.close(); } }
public V call() { boolean success = false; // in JTA, transaction is bigger than the session _cf.beginTransaction(); ConfStoreConnection conn = getConnection(); try { V r = call(conn); _cf.commitTransaction(); success = true; return r; } finally { if (!success) try { _cf.rollbackTransaction(); } catch (Exception ex) { __log.error("DbError", ex); } } // session is closed automatically when committed or rolled back under JTA }