From 17137635fcc6a07e619af8e40017531817d1c8b4 Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Tue, 4 Nov 2008 09:16:41 +0000 Subject: [PATCH] FR: [ 2214883 ] Remove SQL code and Replace for Query --- base/src/org/compiere/model/MCommission.java | 35 ++++---------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/base/src/org/compiere/model/MCommission.java b/base/src/org/compiere/model/MCommission.java index 2c4d1a008c..bd5ef602ce 100644 --- a/base/src/org/compiere/model/MCommission.java +++ b/base/src/org/compiere/model/MCommission.java @@ -28,6 +28,7 @@ import org.compiere.util.*; * @author Jorg Janke * @version $Id: MCommission.java,v 1.3 2006/07/30 00:51:02 jjanke Exp $ * @author victor.perez@e-evolution.com www.e-evolution.com [ 1867477 ] http://sourceforge.net/tracker/index.php?func=detail&aid=1867477&group_id=176962&atid=879332 + * FR: [ 2214883 ] Remove SQL code and Replace for Query - red1 */ public class MCommission extends X_C_Commission { @@ -72,35 +73,11 @@ public class MCommission extends X_C_Commission public MCommissionLine[] getLines() { //[ 1867477 ] - String sql = "SELECT * FROM C_CommissionLine WHERE IsActive='Y' AND C_Commission_ID=? ORDER BY Line"; - ArrayList list = new ArrayList(); - PreparedStatement pstmt = null; - try - { - pstmt = DB.prepareStatement(sql, get_TrxName()); - pstmt.setInt(1, getC_Commission_ID()); - ResultSet rs = pstmt.executeQuery(); - while (rs.next()) - list.add(new MCommissionLine(getCtx(), rs, get_TrxName())); - rs.close(); - pstmt.close(); - pstmt = null; - } - catch (Exception e) - { - log.log(Level.SEVERE, sql, e); - } - try - { - if (pstmt != null) - pstmt.close(); - pstmt = null; - } - catch (Exception e) - { - pstmt = null; - } - + //FR: [ 2214883 ] Remove SQL code and Replace for Query - red1 + String whereClause = "IsActive='Y' AND C_Commission_ID=?"; + List list = new Query(getCtx(), MCommissionLine.Table_Name, whereClause, get_TrxName()) + .setParameters(new Object[]{getC_Commission_ID()}) + .list(); // Convert MCommissionLine[] retValue = new MCommissionLine[list.size()]; list.toArray(retValue);