Spring Boot - BigInteger value in the response body is not correct

32 Views Asked by At

I have a field "old" with the data type BigInteger in Spring Boot.

Property in Entity:

@Column(name = "old")
private java.math.BigInteger old;

In the database, this field "old" is of the following data type: Number(20,0).

Column in Oracle Database:

old NUMBER(20,0)

When reading the entity, I get the following value: 12345678912345678912 from the database. (I can see this in Debugger.) This is correct. The same value is in the database.

However, I get the following value in the response body: 12345678912345680000. This is not correct.

Response as JSON

{
...
"old": 12345678912345680000,
...
}

How can I get the correct value in the response body?

0

There are 0 best solutions below