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:
parent
03153697fe
commit
583954e3eb
|
@ -19,6 +19,7 @@ package org.compiere.model;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -51,37 +52,10 @@ public class MProductPrice extends X_M_ProductPrice
|
||||||
public static MProductPrice get (Properties ctx, int M_PriceList_Version_ID, int M_Product_ID,
|
public static MProductPrice get (Properties ctx, int M_PriceList_Version_ID, int M_Product_ID,
|
||||||
String trxName)
|
String trxName)
|
||||||
{
|
{
|
||||||
MProductPrice retValue = null;
|
final String whereClause = MProductPrice.COLUMNNAME_M_PriceList_Version_ID +"=? AND "+MProductPrice.COLUMNNAME_M_Product_ID+"=?";
|
||||||
String sql = "SELECT * FROM M_ProductPrice WHERE M_PriceList_Version_ID=? AND M_Product_ID=?";
|
MProductPrice retValue = new Query(ctx,I_M_ProductPrice.Table_Name, whereClause, trxName)
|
||||||
PreparedStatement pstmt = null;
|
.setParameters(M_PriceList_Version_ID, M_Product_ID)
|
||||||
try
|
.first();
|
||||||
{
|
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
|
||||||
pstmt.setInt (1, M_PriceList_Version_ID);
|
|
||||||
pstmt.setInt (2, M_Product_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
|
||||||
if (rs.next ())
|
|
||||||
{
|
|
||||||
retValue = new MProductPrice (ctx, rs, trxName);
|
|
||||||
}
|
|
||||||
rs.close ();
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
s_log.log (Level.SEVERE, sql, e);
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
return retValue;
|
return retValue;
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue