From 75378bbc817ec8d782694bb9ff0eb877bd3e4148 Mon Sep 17 00:00:00 2001 From: "Redhuan D. Oon" Date: Tue, 2 Sep 2008 09:20:58 +0000 Subject: [PATCH] Applying FR [ 1981760 ] Improve Query class Teo, pls review if this the right way? If not pls revert. Thanks! --- base/src/org/compiere/model/MMovement.java | 34 ++++------------------ 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/base/src/org/compiere/model/MMovement.java b/base/src/org/compiere/model/MMovement.java index 5a76b19998..6acba19d2a 100644 --- a/base/src/org/compiere/model/MMovement.java +++ b/base/src/org/compiere/model/MMovement.java @@ -86,35 +86,11 @@ public class MMovement extends X_M_Movement implements DocAction return m_lines; } // - ArrayList list = new ArrayList(); - String sql = "SELECT * FROM M_MovementLine WHERE M_Movement_ID=? ORDER BY Line"; - PreparedStatement pstmt = null; - try - { - pstmt = DB.prepareStatement (sql, get_TrxName()); - pstmt.setInt (1, getM_Movement_ID()); - ResultSet rs = pstmt.executeQuery (); - while (rs.next ()) - { - list.add (new MMovementLine (getCtx(), rs, get_TrxName())); - } - rs.close (); - pstmt.close (); - pstmt = null; - } catch (Exception e) - { - log.log(Level.SEVERE, "getLines", e); - } - try - { - if (pstmt != null) - pstmt.close (); - pstmt = null; - } catch (Exception e) - { - pstmt = null; - } - + String whereClause = ""; + List list = new Query(getCtx(), MMovement.Table_Name, whereClause, null) + .setParameters(new Object[]{"Y", getM_Movement_ID()}) + .setOrderBy("Line") + .list(); m_lines = new MMovementLine[list.size ()]; list.toArray (m_lines); return m_lines;