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-04-14 07:07:40 +00:00
parent 7d71f46528
commit e6d669d51b
1 changed files with 6 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
@ -32,6 +32,8 @@ import org.compiere.util.Env;
* @author Jorg Janke
* @author victor.perez@e-evolution.com, www.e-evolution.com
* <li>RF [ 2214883 ] Remove SQL code and Replace for Query http://sourceforge.net/tracker/index.php?func=detail&aid=2214883&group_id=176962&atid=879335
* @author Teo Sarca, www.arhipac.ro
* <li>FR [ 2694043 ] Query. first/firstOnly usage best practice
* @version $Id: MAccount.java,v 1.4 2006/07/30 00:58:04 jjanke Exp $
*/
public class MAccount extends X_C_ValidCombination
@ -195,7 +197,7 @@ public class MAccount extends X_C_ValidCombination
MAccount existingAccount = new Query(ctx, MAccount.Table_Name, whereClause.toString(), null)
.setParameters(params)
.setOnlyActiveRecords(true)
.first();
.firstOnly();
// Existing
if (existingAccount != null)
@ -242,7 +244,8 @@ public class MAccount extends X_C_ValidCombination
{
String whereClause = "C_AcctSchema_ID=? AND Alias=?";
MAccount retValue = new Query(ctx,MAccount.Table_Name,whereClause.toString(),null)
.setParameters(new Object[]{C_AcctSchema_ID,alias}).first();
.setParameters(new Object[]{C_AcctSchema_ID,alias})
.firstOnly();
return retValue;
} // get