Jasper Reports java.lang.ClassCastException with sqlite

Issue

This Content is from Stack Overflow. Question asked by Anonymous Coder

I am working with my jasper reports with a subreport returning a currency value to the main report.
The current value that should be returned and displayed to the main report is 900

I keep having an error

Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigDecimal

When I change the value having a decimal like 900.10, the error is Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.math.BigDecimal

I have no issues when I am using MySQL as my datasource but whenever I switch to SQLite.
I’m having problems regarding the field types, especially with Big Decimals (I use Big Decimal coz I believe it is the correct data type to be used in storing currency values.)

I am working on a portable version of my app which is why I changed its database to SQLite.



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?