MPPProductBOM.getDefault - if outside transaction then cache it (optimization)

This commit is contained in:
teo_sarca 2009-06-27 08:28:16 +00:00
parent 779c91d030
commit 337aead288
1 changed files with 8 additions and 1 deletions

View File

@ -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;
}
/**