FR: [ 2214883 ] Remove SQL code and Replace for Query
-- JUnit test pending Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
parent
64d83bfa5e
commit
0ff7666a2b
|
@ -17,13 +17,10 @@
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
|
||||||
|
|
||||||
import org.compiere.util.DB;
|
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,35 +83,10 @@ public class MCommissionRun extends X_C_CommissionRun
|
||||||
*/
|
*/
|
||||||
public MCommissionAmt[] getAmts()
|
public MCommissionAmt[] getAmts()
|
||||||
{
|
{
|
||||||
String sql = "SELECT * FROM C_CommissionAmt WHERE C_CommissionRun_ID=?";
|
final String whereClause = I_C_CommissionRun.COLUMNNAME_C_CommissionRun_ID+"=?";
|
||||||
ArrayList<MCommissionAmt> list = new ArrayList<MCommissionAmt>();
|
List<MCommissionAmt> list = new Query(getCtx(),I_C_CommissionAmt.Table_Name,whereClause,get_TrxName())
|
||||||
PreparedStatement pstmt = null;
|
.setParameters(getC_CommissionRun_ID())
|
||||||
try
|
.list();
|
||||||
{
|
|
||||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
|
||||||
pstmt.setInt(1, getC_CommissionRun_ID());
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
|
||||||
while (rs.next())
|
|
||||||
list.add(new MCommissionAmt(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;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Convert
|
// Convert
|
||||||
MCommissionAmt[] retValue = new MCommissionAmt[list.size()];
|
MCommissionAmt[] retValue = new MCommissionAmt[list.size()];
|
||||||
list.toArray(retValue);
|
list.toArray(retValue);
|
||||||
|
|
Loading…
Reference in New Issue