We have one page where we are fetching the data from database. one field "AmountEur" is there which is getting rounding off (using bigdecimal.ROUND_HALF_UP method) before showing it up on view page.
the code is like this :
final Object amountEur = result.get("mtmAmountEUR");
if (amountEur != null) {
BigDecimal mtmAmt = ((BigDecimal) amountEur ).setScale(0, BigDecimal.ROUND_HALF_UP);
result.put("mtmAmount", mtmAmt);
}
With this code, i am facing one issue. suppose if the data fetched from db is 2650.5, then the data shown in the view page is 2650 only. ideally it should be 2651. on the other hand, If the data is 2650.55 in db, it is showing fine on view page i.e 2651. I do not know what is the problem with my code. Could someone please help.