From 48db341e5a436a047222c0a8a4def1d30511ecfb Mon Sep 17 00:00:00 2001 From: vpj-cd Date: Fri, 5 Sep 2008 18:57:31 +0000 Subject: [PATCH] Implement the transaction because very long --- base/src/org/eevolution/process/MRPUpdate.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/base/src/org/eevolution/process/MRPUpdate.java b/base/src/org/eevolution/process/MRPUpdate.java index f26652e1e2..8e67fd42c4 100644 --- a/base/src/org/eevolution/process/MRPUpdate.java +++ b/base/src/org/eevolution/process/MRPUpdate.java @@ -36,6 +36,7 @@ import org.compiere.process.SvrProcess; import org.compiere.util.DB; import org.compiere.util.Env; import org.compiere.util.Msg; +import org.compiere.util.Trx; import org.eevolution.model.MForecastLine; import org.eevolution.model.MPPMRP; import org.eevolution.model.MPPOrder; @@ -301,29 +302,35 @@ public class MRPUpdate extends SvrProcess private void executeUpdate(String sql, List params) { + Trx trx = Trx.get(Trx.createTrxName("Update MRP"), true); Object[] pa = null; if (params != null) pa = params.toArray(new Object[params.size()]); else pa = new Object[]{}; // - int no = DB.executeUpdateEx(sql, pa, get_TrxName()); + int no = DB.executeUpdateEx(sql, pa, trx.getTrxName()); log.fine("#"+no+" -- "+sql); - } + trx.commit(); + } + private void deletePO(String tableName, String whereClause, List params) { // TODO: refactor this method and move it to org.compiere.model.Query class - POResultSet rs = new Query(getCtx(), tableName, whereClause, get_TrxName()) + Trx trx = Trx.get(Trx.createTrxName("Delete MRP"), true); + POResultSet rs = new Query(getCtx(), tableName, whereClause, trx.getTrxName()) .setParameters(params) .scroll(); try { while(rs.hasNext()) { rs.next().deleteEx(true); + } } finally { + trx.commit(); rs.close(); } }