diff --git a/org.adempiere.base/src/org/compiere/model/MColumn.java b/org.adempiere.base/src/org/compiere/model/MColumn.java index 8f7d2fae6e..869257a0cd 100644 --- a/org.adempiere.base/src/org/compiere/model/MColumn.java +++ b/org.adempiere.base/src/org/compiere/model/MColumn.java @@ -63,6 +63,7 @@ public class MColumn extends X_AD_Column * Get MColumn from Cache * @param ctx context * @param AD_Column_ID id + * @param trxName trx * @return MColumn */ public static MColumn get(Properties ctx, int AD_Column_ID, String trxName) @@ -807,11 +808,11 @@ public class MColumn extends X_AD_Column if (DisplayType.TableDir == refid || (DisplayType.Search == refid && getAD_Reference_Value_ID() == 0)) { foreignTable = getColumnName().substring(0, getColumnName().length()-3); } else if (DisplayType.Table == refid || DisplayType.Search == refid) { - MReference ref = MReference.get(getCtx(), getAD_Reference_Value_ID()); + MReference ref = MReference.get(getCtx(), getAD_Reference_Value_ID(), get_TrxName()); if (MReference.VALIDATIONTYPE_TableValidation.equals(ref.getValidationType())) { int cnt = DB.getSQLValueEx(get_TrxName(), "SELECT COUNT(*) FROM AD_Ref_Table WHERE AD_Reference_ID=?", getAD_Reference_Value_ID()); if (cnt == 1) { - MRefTable rt = MRefTable.get(getCtx(), getAD_Reference_Value_ID()); + MRefTable rt = MRefTable.get(getCtx(), getAD_Reference_Value_ID(), get_TrxName()); if (rt != null) foreignTable = rt.getAD_Table().getTableName(); } diff --git a/org.adempiere.base/src/org/compiere/model/MProcessPara.java b/org.adempiere.base/src/org/compiere/model/MProcessPara.java index efcdfc111d..94ab2e5f39 100644 --- a/org.adempiere.base/src/org/compiere/model/MProcessPara.java +++ b/org.adempiere.base/src/org/compiere/model/MProcessPara.java @@ -297,9 +297,9 @@ public class MProcessPara extends X_AD_Process_Para || (DisplayType.Search == getAD_Reference_ID() && getAD_Reference_Value_ID() == 0)) { foreignTable = getColumnName().substring(0, getColumnName().length()-3); } else if (DisplayType.Table == getAD_Reference_ID() || DisplayType.Search == getAD_Reference_ID()) { - MReference ref = MReference.get(getCtx(), getAD_Reference_Value_ID()); + MReference ref = MReference.get(getCtx(), getAD_Reference_Value_ID(), get_TrxName()); if (MReference.VALIDATIONTYPE_TableValidation.equals(ref.getValidationType())) { - MRefTable rt = MRefTable.get(getCtx(), getAD_Reference_Value_ID()); + MRefTable rt = MRefTable.get(getCtx(), getAD_Reference_Value_ID(), get_TrxName()); if (rt != null) foreignTable = rt.getAD_Table().getTableName(); } diff --git a/org.adempiere.base/src/org/compiere/model/MRefTable.java b/org.adempiere.base/src/org/compiere/model/MRefTable.java index 1350982c9b..595c8c80cb 100644 --- a/org.adempiere.base/src/org/compiere/model/MRefTable.java +++ b/org.adempiere.base/src/org/compiere/model/MRefTable.java @@ -27,7 +27,7 @@ public class MRefTable extends X_AD_Ref_Table /** * */ - private static final long serialVersionUID = -699466856436251075L; + private static final long serialVersionUID = -3595900192339578282L; /** * Standard Constructor @@ -68,19 +68,27 @@ public class MRefTable extends X_AD_Ref_Table /** Ref Table Cache */ private static CCache s_cache = new CCache(Table_Name, 20); + public static MRefTable get (Properties ctx, int AD_Reference_ID) + { + return get (ctx, AD_Reference_ID, null); + } + /** * Get from Cache * @param ctx context * @param AD_Reference_ID id + * @param trxName trx * @return category */ - public static MRefTable get (Properties ctx, int AD_Reference_ID) + public static MRefTable get (Properties ctx, int AD_Reference_ID, String trxName) { Integer ii = Integer.valueOf(AD_Reference_ID); MRefTable retValue = (MRefTable)s_cache.get(ii); - if (retValue != null) + if (retValue != null) { + retValue.set_TrxName(trxName); return retValue; - retValue = new MRefTable (ctx, AD_Reference_ID, null); + } + retValue = new MRefTable (ctx, AD_Reference_ID, trxName); if (retValue.get_ID () != 0) s_cache.put (AD_Reference_ID, retValue); return retValue; diff --git a/org.adempiere.base/src/org/compiere/model/MReference.java b/org.adempiere.base/src/org/compiere/model/MReference.java index 372f8cc5ac..369a135cdd 100644 --- a/org.adempiere.base/src/org/compiere/model/MReference.java +++ b/org.adempiere.base/src/org/compiere/model/MReference.java @@ -33,7 +33,7 @@ public class MReference extends X_AD_Reference { /** * */ - private static final long serialVersionUID = 119105464164520763L; + private static final long serialVersionUID = 343092563490562893L; /** * Standard Constructor @@ -61,19 +61,27 @@ public class MReference extends X_AD_Reference { /** Reference Cache */ private static CCache s_cache = new CCache(Table_Name, 20); + public static MReference get (Properties ctx, int AD_Reference_ID) + { + return get(ctx, AD_Reference_ID, null); + } + /** * Get from Cache * @param ctx context * @param AD_Reference_ID id + * @param trxName trx * @return category */ - public static MReference get (Properties ctx, int AD_Reference_ID) + public static MReference get (Properties ctx, int AD_Reference_ID, String trxName) { Integer ii = Integer.valueOf(AD_Reference_ID); MReference retValue = (MReference)s_cache.get(ii); - if (retValue != null) + if (retValue != null) { + retValue.set_TrxName(trxName); return retValue; - retValue = new MReference (ctx, AD_Reference_ID, null); + } + retValue = new MReference (ctx, AD_Reference_ID, trxName); if (retValue.get_ID () != 0) s_cache.put (AD_Reference_ID, retValue); return retValue;