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
ede3856d8f
commit
e80c558107
|
@ -98,37 +98,13 @@ public class MBPartner extends X_C_BPartner
|
||||||
public static MBPartner getBPartnerCashTrx (Properties ctx, int AD_Client_ID)
|
public static MBPartner getBPartnerCashTrx (Properties ctx, int AD_Client_ID)
|
||||||
{
|
{
|
||||||
MBPartner retValue = null;
|
MBPartner retValue = null;
|
||||||
String sql = "SELECT * FROM C_BPartner "
|
final String whereClause = "C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
||||||
+ "WHERE C_BPartner_ID IN (SELECT C_BPartnerCashTrx_ID FROM AD_ClientInfo WHERE AD_Client_ID=?)";
|
retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause, null)
|
||||||
PreparedStatement pstmt = null;
|
.setParameters(AD_Client_ID)
|
||||||
try
|
.first();
|
||||||
{
|
if (retValue == null)
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
|
||||||
pstmt.setInt(1, AD_Client_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery();
|
|
||||||
if (rs.next())
|
|
||||||
retValue = new MBPartner (ctx, rs, null);
|
|
||||||
else
|
|
||||||
s_log.log(Level.SEVERE, "Not found for AD_Client_ID=" + AD_Client_ID);
|
s_log.log(Level.SEVERE, "Not found for AD_Client_ID=" + AD_Client_ID);
|
||||||
rs.close();
|
|
||||||
pstmt.close();
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
s_log.log(Level.SEVERE, sql, e);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (pstmt != null)
|
|
||||||
pstmt.close ();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{}
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
return retValue;
|
return retValue;
|
||||||
} // getBPartnerCashTrx
|
} // getBPartnerCashTrx
|
||||||
|
|
||||||
|
@ -142,9 +118,9 @@ public class MBPartner extends X_C_BPartner
|
||||||
{
|
{
|
||||||
if (Value == null || Value.length() == 0)
|
if (Value == null || Value.length() == 0)
|
||||||
return null;
|
return null;
|
||||||
String whereClause = "Value=? AND AD_Client_ID=?";
|
final String whereClause = "Value=? AND AD_Client_ID=?";
|
||||||
MBPartner retValue = new Query(ctx,MBPartner.Table_Name,whereClause.toString(),null)
|
MBPartner retValue = new Query(ctx, I_C_BPartner.Table_Name, whereClause.toString(), null)
|
||||||
.setParameters(new Object[]{Value,Env.getAD_Client_ID(ctx)})
|
.setParameters(Value,Env.getAD_Client_ID(ctx))
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
return retValue;
|
return retValue;
|
||||||
} // get
|
} // get
|
||||||
|
@ -158,8 +134,8 @@ public class MBPartner extends X_C_BPartner
|
||||||
public static MBPartner get (Properties ctx, int C_BPartner_ID)
|
public static MBPartner get (Properties ctx, int C_BPartner_ID)
|
||||||
{
|
{
|
||||||
String whereClause = "C_BPartner_ID=? AND AD_Client_ID=?";
|
String whereClause = "C_BPartner_ID=? AND AD_Client_ID=?";
|
||||||
MBPartner retValue = new Query(ctx,MBPartner.Table_Name,whereClause.toString(),null)
|
MBPartner retValue = new Query(ctx,I_C_BPartner.Table_Name,whereClause.toString(),null)
|
||||||
.setParameters(new Object[]{C_BPartner_ID,Env.getAD_Client_ID(ctx)})
|
.setParameters(C_BPartner_ID,Env.getAD_Client_ID(ctx))
|
||||||
.firstOnly();
|
.firstOnly();
|
||||||
return retValue;
|
return retValue;
|
||||||
} // get
|
} // get
|
||||||
|
|
Loading…
Reference in New Issue