From 337aead288a0b335112e0d2a9e1567d2d51a6d7e Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Sat, 27 Jun 2009 08:28:16 +0000 Subject: [PATCH] MPPProductBOM.getDefault - if outside transaction then cache it (optimization) --- base/src/org/eevolution/model/MPPProductBOM.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/base/src/org/eevolution/model/MPPProductBOM.java b/base/src/org/eevolution/model/MPPProductBOM.java index 5d894cfb4e..2a312fa7c0 100644 --- a/base/src/org/eevolution/model/MPPProductBOM.java +++ b/base/src/org/eevolution/model/MPPProductBOM.java @@ -92,10 +92,17 @@ public class MPPProductBOM extends X_PP_Product_BOM */ public static MPPProductBOM getDefault(MProduct product, String trxName) { - return new Query(product.getCtx(), Table_Name, "M_Product_ID=? AND Value=?", trxName) + MPPProductBOM bom = new Query(product.getCtx(), Table_Name, "M_Product_ID=? AND Value=?", trxName) .setParameters(new Object[]{product.getM_Product_ID(), product.getValue()}) .setClient_ID() .firstOnly(); + // If outside trx, then cache it + if (bom != null && trxName == null) + { + s_cache.put(bom.get_ID(), bom); + } + // + return bom; } /**