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:
parent
cf06679111
commit
57c8b13b98
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue