One class per day initiative.

FR: [ 2214883 ] Remove SQL code and Replace for Query
https://sourceforge.net/tracker/?func=detail&atid=879335&aid=2214883&group_id=176962
This commit is contained in:
trifonnt 2008-11-02 19:20:07 +00:00
parent 537ce85a55
commit ae7064145d
2 changed files with 17 additions and 35 deletions

View File

@ -16,11 +16,12 @@
*****************************************************************************/ *****************************************************************************/
package org.compiere.model; package org.compiere.model;
import java.sql.*; import java.sql.ResultSet;
import java.util.*; import java.util.ArrayList;
import java.util.Properties;
import java.util.logging.*; import org.compiere.util.CLogger;
import org.compiere.util.*; import org.compiere.util.KeyNamePair;
/** /**
* Accounting Schema GL info * Accounting Schema GL info
@ -30,6 +31,12 @@ import org.compiere.util.*;
*/ */
public class MAcctSchemaGL extends X_C_AcctSchema_GL public class MAcctSchemaGL extends X_C_AcctSchema_GL
{ {
/**
*
*/
private static final long serialVersionUID = 1L;
/** /**
* Get Accounting Schema GL Info * Get Accounting Schema GL Info
* @param ctx context * @param ctx context
@ -38,36 +45,11 @@ public class MAcctSchemaGL extends X_C_AcctSchema_GL
*/ */
public static MAcctSchemaGL get (Properties ctx, int C_AcctSchema_ID) public static MAcctSchemaGL get (Properties ctx, int C_AcctSchema_ID)
{ {
MAcctSchemaGL retValue = null; String whereClause = "C_AcctSchema_ID=?";
String sql = "SELECT * FROM C_AcctSchema_GL WHERE C_AcctSchema_ID=?"; MAcctSchemaGL retValue = new Query(ctx, MAcctSchemaGL.Table_Name, whereClause, null)
PreparedStatement pstmt = null; .setParameters(new Object[]{C_AcctSchema_ID})
try .first()
{ ;
pstmt = DB.prepareStatement(sql, null);
pstmt.setInt(1, C_AcctSchema_ID);
ResultSet rs = pstmt.executeQuery();
if (rs.next())
{
retValue = new MAcctSchemaGL (ctx, rs, null);
}
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

View File

@ -54,7 +54,7 @@ public class MAchievement extends X_PA_Achievement
.setParameters(new Object[]{PA_Measure_ID}).setOrderBy("SeqNo, DateDoc").list(); .setParameters(new Object[]{PA_Measure_ID}).setOrderBy("SeqNo, DateDoc").list();
MAchievement[] retValue = new MAchievement[list.size ()]; MAchievement[] retValue = new MAchievement[list.size ()];
list.toArray (retValue); retValue = list.toArray (retValue);
return retValue; return retValue;
} // getOfMeasure } // getOfMeasure