From e6d669d51bcee8fc325dc7a7467918da33a11b31 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Tue, 14 Apr 2009 07:07:40 +0000 Subject: [PATCH] Query. first/firstOnly usage best practice https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2694043&group_id=176962 --- base/src/org/compiere/model/MAccount.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/base/src/org/compiere/model/MAccount.java b/base/src/org/compiere/model/MAccount.java index ce7e4ca833..9cf01e404d 100644 --- a/base/src/org/compiere/model/MAccount.java +++ b/base/src/org/compiere/model/MAccount.java @@ -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 *
  • 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 + *
  • 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