FR: [ 2214883 ] Remove SQL code and Replace for Query

-- JUnit test in next commit (no failures)
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Redhuan D. Oon 2010-02-27 02:26:04 +00:00
parent 8df91cee04
commit 0da2f340e7
1 changed files with 9 additions and 24 deletions

View File

@ -20,6 +20,7 @@ import java.math.BigDecimal;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.compiere.util.CLogger; import org.compiere.util.CLogger;
@ -717,30 +718,14 @@ public class MProductPricing
if (m_M_Product_ID == 0) if (m_M_Product_ID == 0)
return; return;
// //
String sql = "SELECT C_UOM_ID, M_Product_Category_ID FROM M_Product WHERE M_Product_ID=?"; //FR: [ 2214883 ] Remove SQL code and Replace for Query - red1
PreparedStatement pstmt = null; String whereClause = "M_Product_ID=?";
ResultSet rs = null; MProduct retValue = new Query(Env.getCtx(), I_M_Product.Table_Name, whereClause, null)
try .setParameters(m_M_Product_ID)
{ .first();
pstmt = DB.prepareStatement(sql, null); m_C_UOM_ID = retValue.getC_UOM_ID();
pstmt.setInt(1, m_M_Product_ID); m_M_Product_Category_ID = retValue.getM_Product_Category_ID();
rs = pstmt.executeQuery();
if (rs.next())
{
m_C_UOM_ID = rs.getInt (1);
m_M_Product_Category_ID = rs.getInt(2);
}
}
catch (Exception e)
{
log.log(Level.SEVERE, sql, e);
}
finally
{
DB.close(rs, pstmt);
rs = null;
pstmt = null;
}
} // setBaseInfo } // setBaseInfo
/** /**