FR [ 2694043 ] Query. first/firstOnly usage best practice

https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2694043&group_id=176962
This commit is contained in:
teo_sarca 2009-03-20 09:40:19 +00:00
parent cf06679111
commit 57c8b13b98
6 changed files with 7 additions and 6 deletions

View File

@ -138,7 +138,7 @@ public final class MAccountLookup extends Lookup implements Serializable
String whereClause = "C_ValidCombination_ID=?";
MAccount account = new Query(Env.getCtx(),MAccount.Table_Name,whereClause,null)
.setParameters(new Object[]{ID})
.first();
.firstOnly();
if(account == null)
return false;

View File

@ -52,7 +52,7 @@ public class MAcctSchemaGL extends X_C_AcctSchema_GL
String whereClause = "C_AcctSchema_ID=?";
return new Query(ctx,MAcctSchemaGL.Table_Name,whereClause,null)
.setParameters(new Object[]{C_AcctSchema_ID})
.first();
.firstOnly();
} // get
/** Logger */

View File

@ -152,7 +152,8 @@ public class MBPartner extends X_C_BPartner
{
String whereClause = "C_BPartner_ID=? AND AD_Client_ID=?";
MBPartner retValue = new Query(ctx,MBPartner.Table_Name,whereClause.toString(),null)
.setParameters(new Object[]{C_BPartner_ID,Env.getAD_Client_ID(ctx)}).first();
.setParameters(new Object[]{C_BPartner_ID,Env.getAD_Client_ID(ctx)})
.firstOnly();
return retValue;
} // get

View File

@ -68,7 +68,7 @@ public class MLanguage extends X_AD_Language
{
return new Query(ctx, Table_Name, COLUMNNAME_AD_Language+"=?", null)
.setParameters(new Object[]{AD_Language})
.first();
.firstOnly();
} // get
/**

View File

@ -49,7 +49,7 @@ public class MOrgInfo extends X_AD_OrgInfo
}
retValue = new Query(ctx, Table_Name, "AD_Org_ID=?", null)
.setParameters(new Object[]{AD_Org_ID})
.first();
.firstOnly();
if (retValue != null)
{
s_cache.put(AD_Org_ID, retValue);

View File

@ -53,7 +53,7 @@ public class MProductCategoryAcct extends X_M_Product_Category_Acct
final String whereClause = "M_Product_Category_ID=? AND C_AcctSchema_ID=?";
acct = new Query(ctx, Table_Name, whereClause, trxName)
.setParameters(new Object[]{M_Product_Category_ID, C_AcctSchema_ID})
.first();
.firstOnly();
if (acct != null)
{
s_cache.put(key, acct);