From 85ddbcd144116c18706ca6ffd8e5bb45856a3f14 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 29 Jan 2007 11:52:00 +0000 Subject: [PATCH] * Align startDBProcess with startProcess transaction semantic --- .../main/ejb/org/compiere/session/ServerBean.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java b/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java index 808d1e1203..57b4d778ff 100644 --- a/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java +++ b/serverRoot/src/main/ejb/org/compiere/session/ServerBean.java @@ -597,16 +597,29 @@ public class ServerBean implements SessionBean public ProcessInfo dbProcess(ProcessInfo processInfo, String procedureName, String trxName) { String sql = "{call " + procedureName + "(?)}"; + Trx trx = null; + if (trxName != null) + trx = Trx.get(trxName, true); try { CallableStatement cstmt = DB.prepareCall(sql, ResultSet.CONCUR_UPDATABLE, trxName); cstmt.setInt(1, processInfo.getAD_PInstance_ID()); cstmt.executeUpdate(); cstmt.close(); + if (trx != null && trx.isActive()) + { + trx.commit(true); + trx.close(); + } } catch (Exception e) { log.log(Level.SEVERE, sql, e); + if (trx != null && trx.isActive()) + { + trx.rollback(); + trx.close(); + } processInfo.setSummary (Msg.getMsg(Env.getCtx(), "ProcessRunError") + " " + e.getLocalizedMessage()); processInfo.setError (true); }