Applying FR [ 1981760 ] Improve Query class

Teo, pls review if this the right way? If not pls revert. Thanks!
This commit is contained in:
Redhuan D. Oon 2008-09-02 09:20:58 +00:00
parent 0548454e07
commit 75378bbc81
1 changed files with 5 additions and 29 deletions

View File

@ -86,35 +86,11 @@ public class MMovement extends X_M_Movement implements DocAction
return m_lines;
}
//
ArrayList<MMovementLine> list = new ArrayList<MMovementLine>();
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<MMovement> 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;