I would like to pass the double value received from web page to sqlServer database. the value are wrapped in a value object.
public class testVO{
Double value;
public Double getValue() {
return value;
}
public void setValue(Double value) {
this.value = value;
}
}
However, the problem I've met is when the value is smaller than 0.0001, it will transfer into 1.0E-4 or other scientific-notation, which causes the database error.
The way I found is to use BigDecimal.valueOf(testVO.getValue())
to parse it.
Is there any other better way to solve it?
Solved: It's not because of scientific-notation problem, Database can read both number and scientific. The problem is the utility package I used while parse it to database will convert all value to string type, hoping don't waste your time!