Updated to use the Query API.
This commit is contained in:
parent
24fd729e47
commit
de88152f83
|
@ -88,7 +88,7 @@ public class MCurrency extends X_C_Currency
|
||||||
/** Store System Currencies **/
|
/** Store System Currencies **/
|
||||||
private static CCache<Integer,MCurrency> s_currencies = new CCache<Integer,MCurrency>("C_Currency", 50);
|
private static CCache<Integer,MCurrency> s_currencies = new CCache<Integer,MCurrency>("C_Currency", 50);
|
||||||
/** Cache System Currencies by using ISO code as key **/
|
/** Cache System Currencies by using ISO code as key **/
|
||||||
private static CCache<String,MCurrency> s_currenciesISO = new CCache<String,MCurrency>("C_Currency", 50);
|
private static CCache<String,MCurrency> s_currenciesISO = new CCache<String,MCurrency>("C_CurrencyISO", 50);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Currency using ISO code
|
* Get Currency using ISO code
|
||||||
|
@ -104,20 +104,9 @@ public class MCurrency extends X_C_Currency
|
||||||
return retValue;
|
return retValue;
|
||||||
|
|
||||||
// Try database
|
// Try database
|
||||||
try {
|
Query query = new Query(ctx, MCurrency.Table_Name, "iso_code=?", null);
|
||||||
Connection conn = DB.createConnection(true, true, Connection.TRANSACTION_READ_COMMITTED);
|
query.setParameters(new Object[]{ISOcode});
|
||||||
PreparedStatement ps = conn.prepareStatement("select * from c_currency where iso_code=?");
|
retValue = (MCurrency)query.first();
|
||||||
ps.setString(1, ISOcode);
|
|
||||||
ResultSet rs = ps.executeQuery();
|
|
||||||
if (rs.next()) {
|
|
||||||
retValue = new MCurrency(ctx, rs, null);
|
|
||||||
}
|
|
||||||
rs.close();
|
|
||||||
ps.close();
|
|
||||||
conn.close();
|
|
||||||
} catch (Exception ee) {
|
|
||||||
log.log(Level.WARNING, ee.getMessage(), ee);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save
|
// Save
|
||||||
if (retValue!=null)
|
if (retValue!=null)
|
||||||
|
|
Loading…
Reference in New Issue