From 1912d32e8d1f8a81fa1cd4b1e512d18145c9b64b Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 29 Oct 2014 13:33:26 -0500 Subject: [PATCH] IDEMPIERE-2284 MProductCategory/MAssetGroup s_cache useless --- .../src/org/compiere/model/MAssetGroup.java | 2 ++ .../src/org/compiere/model/MProductCategory.java | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MAssetGroup.java b/org.adempiere.base/src/org/compiere/model/MAssetGroup.java index de3d9bd917..a7429ca6c3 100644 --- a/org.adempiere.base/src/org/compiere/model/MAssetGroup.java +++ b/org.adempiere.base/src/org/compiere/model/MAssetGroup.java @@ -58,6 +58,8 @@ public class MAssetGroup extends X_A_Asset_Group ag = new MAssetGroup(ctx, A_Asset_Group_ID, null); if (ag != null && ag.get_ID() != A_Asset_Group_ID) ag = null; + else + s_cache.put(A_Asset_Group_ID, ag); // return ag; } diff --git a/org.adempiere.base/src/org/compiere/model/MProductCategory.java b/org.adempiere.base/src/org/compiere/model/MProductCategory.java index 1c836a32d9..4c1603765e 100644 --- a/org.adempiere.base/src/org/compiere/model/MProductCategory.java +++ b/org.adempiere.base/src/org/compiere/model/MProductCategory.java @@ -52,10 +52,13 @@ public class MProductCategory extends X_M_Product_Category public static MProductCategory get (Properties ctx, int M_Product_Category_ID) { Integer ii = new Integer (M_Product_Category_ID); - MProductCategory pc = (MProductCategory)s_cache.get(ii); - if (pc == null) - pc = new MProductCategory (ctx, M_Product_Category_ID, null); - return pc; + MProductCategory retValue = (MProductCategory)s_cache.get(ii); + if (retValue != null) + return retValue; + retValue = new MProductCategory (ctx, M_Product_Category_ID, null); + if (retValue.get_ID () != 0) + s_cache.put (M_Product_Category_ID, retValue); + return retValue; } // get /**