oracle - blazeds converts BigDecimal to string -
i have flex application uses blazeds connect java backend. using remoting, give call api run select statement on table (using conventional jdbc classes) in oracle database.
the table has 2 columns:
product_code of type nvarchar2(32) , demand of type number(10, 0)
my java api follows:
public list<?> getqueryresult(string query) { connection conn = drivermanager.getconnection(connstr, username, password); statement stmt = conn.createstatement(); resultset rs = stmt.executequery(query); arraylist<?> result = new arraylist<?>(); while(rs.next()) { object[] itemarray = new object[2]; itemarray[0] = rs.getobject(1); itemarray[1] = rs.getobject(2); result.add(itemarray); } return result; }
in flex side, have handler result event of remote operation:
private function onresult(e:resultevent) : void { var result:arraycollection = (e.result arraycollection); }
strangely, values corresponding demand column automatically converted string (i debugged find out in backend, these bigdecimal)
any suggestions?
yes indeed, bigdecimal java converted string in actionscript, can read in developer guide. there no bigdecimal in actionscript option - cannot convert bigdecimal int or float.
if sure value represented number(10,0) has values in interval -2,147,483,648 - 2,147,483,647 can convert int in java - see code below:
itemarray[1] = ((bigdecimal)rs.getobject(2)).intvalue();
Comments
Post a Comment