diff --git a/org.adempiere.base/src/org/compiere/model/MField.java b/org.adempiere.base/src/org/compiere/model/MField.java index 305475b916..08f4313ae8 100644 --- a/org.adempiere.base/src/org/compiere/model/MField.java +++ b/org.adempiere.base/src/org/compiere/model/MField.java @@ -19,6 +19,8 @@ package org.compiere.model; import java.sql.ResultSet; import java.util.Properties; +import org.compiere.util.CCache; + /** * Field Model @@ -32,8 +34,31 @@ public class MField extends X_AD_Field /** * */ - private static final long serialVersionUID = 7124162742037904113L; - + private static final long serialVersionUID = 7243492167390659946L; + + /** Cache */ + private static CCache s_cache = new CCache(Table_Name, 20); + + /** + * + * @param ctx + * @param AD_Field_ID + * @return MField + */ + public static MField get(Properties ctx, int AD_Field_ID) + { + Integer key = Integer.valueOf(AD_Field_ID); + MField retValue = s_cache.get (key); + if (retValue != null && retValue.getCtx() == ctx) { + return retValue; + } + retValue = new MField (ctx, AD_Field_ID, null); + if (retValue.get_ID () == AD_Field_ID) { + s_cache.put (key, retValue); + } + return retValue; + } + /** * Standard Constructor * @param ctx context diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java index 4fef53bdfc..13c5c7fdc3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java @@ -212,7 +212,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh if (!gridtab.isLoadComplete()) gridwindow.initTab(i); for (GridField gridfield : gridtab.getFields()) { - MField field = new MField(Env.getCtx(), gridfield.getAD_Field_ID(), null); + MField field = MField.get(Env.getCtx(), gridfield.getAD_Field_ID()); if (field.isQuickEntry()) { if (! isValidQuickEntryType(field.getAD_Reference_ID())) continue;