diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index 8093c590e6..4b3277f1e2 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -24,8 +24,10 @@ import java.util.Date; import java.util.Properties; import java.util.logging.Level; +import org.compiere.Adempiere; import org.compiere.util.CCache; import org.compiere.util.CLogger; +import org.compiere.util.CacheMgt; import org.compiere.util.DB; import org.compiere.util.DisplayType; import org.compiere.util.Util; @@ -44,7 +46,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = 4879268878721712444L; + private static final long serialVersionUID = -4149262106340017798L; /** Constant for Predefine System Configuration Names (in alphabetical order) */ @@ -904,4 +906,17 @@ public class MSysConfig extends X_AD_SysConfig +"]"; } + @Override + protected boolean afterSave(boolean newRecord, boolean success) { + if (success && newRecord && ! getName().endsWith("_NOCACHE")) { + // Clear cache of AD_SysConfig + // This is to clear the cache of AD_SysConfig when creating a new record + // the reset cache is being called on PO when a record is changed or deleted, but not on new + // NOTE also that reset the specific ID doesn't work because the MSysConfig cache holds a + // String type, and CCache.reset(int) just call reset when the key is not an Integer + Adempiere.getThreadPoolExecutor().submit(() -> CacheMgt.get().reset(Table_Name)); + } + return success; + } + } // MSysConfig;