I’m using JPA with hibernate and an Oracle DB (oracle 11.2 xe). I’m trying to save a big number but what gets saved in the DB isn’t the big number I entered.
I have a column where I want to store a big decimal number mapped like this:
@Column(name = "INVOICE_AMOUNT", precision = 25, scale = 2, nullable = false)
private BigDecimal amount;
In the DB the column was created like this:
INVOICE_AMOUNT NUMBER(25,2) DEFAULT 0 NOT NULL,
The problem is when I’m trying to store the number “19999979998000000”. Just before I do the persist I debugged the field and it says:
amount = {java.math.BigDecimal@13204}"1.9999979998E+16"
But in the DB the value that is stored is 20…
Versions:
jpa 1.0
hibernate-3.2.6.ga.jar
jboss-4.2.3.GA
What am I doing wrong?
Upgrading to ojdbc14 version 10.2.0.5 solves the problem (I think its fixed in 10.2.0.4)