IDEMPIERE-5675 MTable.getPO cache for model factory wrongly removing from cache when PO is not found (#1788)

This commit is contained in:
Carlos Ruiz 2023-04-18 14:34:29 +02:00 committed by GitHub
parent d0e6c050bd
commit beed782d4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 8 deletions

View File

@ -576,8 +576,7 @@ public class MTable extends X_AD_Table implements ImmutablePOSupport
{
if (po.get_ID() != Record_ID && Record_ID > 0)
po = null;
else
return po;
return po;
}
}
s_modelFactoryCache.remove(tableName);
@ -596,21 +595,19 @@ public class MTable extends X_AD_Table implements ImmutablePOSupport
{
if (po.get_ID() != Record_ID && Record_ID > 0)
po = null;
else
{
s_modelFactoryCache.put(tableName, factory);
break;
}
s_modelFactoryCache.put(tableName, factory);
break;
}
}
}
}
if (po == null)
if (po == null && s_modelFactoryCache.get(tableName) == null)
{
po = new GenericPO(tableName, getCtx(), Record_ID, trxName);
if (po.get_ID() != Record_ID && Record_ID > 0)
po = null;
// TODO: how to add GenericPO to the s_modelFactoryCache ??
}
return po;