Problem: Seems my mapping class for a big decimal is dropping 0 when grabbing values like 50.20 from the oracle database. It will grab the value correctly if its 50.23 but nothing with a 0 on the end. I imagine its something simple i am missing. Suggestions? Thanks in advance.
Details
Database: Oracle 11G Field Definition: Numeric(8,2)
mapping getter/setter
@Column ( name="PRICE", precision = 8, scale = 2 )
private BigDecimal price;
public BigDecimal getPrice()
{
return price;
}
public void setPrice( BigDecimal price )
{
this.price = price;
}
50.2 is the same as 50.20, 50.200, etc. If you want to display it with two digits use java.text.DecimalFormat.format(..)
Specifying precision limits the maximum number of decimal digits, not the minimum.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With