I am running into hibernate issue and need help.
Below is technology stack used -
Hibernate 3.2, Spring 3.2, Java 8, Oracle 12C and Tomcat 9
We have a BigDecimal value which is added by users in front-end.
I have a model entity and a VO class.Value looks good in VO, but while hibernate merge value is converting to exponential form, and its getting inserted incorrectly in database.
Initial Amount: -98332000 (Received from different source)
Adjust amount: 983320000 (Amount entered from UI)
Net Adjust Amount: 0 (Calculation done in java Initial Amount + Adjust Amount)
Initial Amount: -98332000
Adjust amount: 983320000
Here hibernate is converting Initial Amount to exponential value - 98.33
Hence instead of getting net amount to 0, I am getting some value.
I could see hibernate uses toString() while saving BigDecimal value.
Instead if manually saved using toPlainString() its working fine.
Is there any entity property or hibernate dialect property need to be modified, so that hibernate saves it correctly without explicitly using toPlainString() ?