You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Jacques Le Roux (JIRA)" <ji...@apache.org> on 2009/09/09 20:05:58 UTC

[jira] Commented: (OFBIZ-2833) Receive offline payment (May be the Entity Engine) has decimal precision problem

    [ https://issues.apache.org/jira/browse/OFBIZ-2833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12753193#action_12753193 ] 

Jacques Le Roux commented on OFBIZ-2833:
----------------------------------------

I checked this problem does not exist in PostGres (8.3). I suggest to close this issue as Derby is not our recommenced DBMS for production, PostGres is. Any other opinions ?

> Receive offline payment (May be the Entity Engine) has decimal precision problem
> --------------------------------------------------------------------------------
>
>                 Key: OFBIZ-2833
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-2833
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework, order
>    Affects Versions: Release Branch 9.04, SVN trunk
>         Environment: The Database I'm used for testing is the built in Derby. I'm not sure if other DBMS has same problem.
>            Reporter: Miles Huang
>
> Reproduce the problem is simple. In Order Manager Application, simply enter an offline payment for a sales order with amount $65.30, the payment amount stored in the DB will change to $65.29.
> Digging into the code, in the org.ofbiz.order.OrderManagerEvents.receiveOfflinePayment method, although the passed in amountStr is "65.30", the parsed out BigDecimal paymentTypeAmount have value "65.2999999999999971578290569595992565155029296875". Checking the payment amount stored in the Payments entity use web tools, the result is 65.29. And the order still has $0.01 outstanding amount.
> Parse the BigDecimal value from string directly may solve the problem partially. But imagine if someone enters $65.299, the problem is still there.
> Or a better and safe solution, in Entity Engine, always round half up BigDecimal value to the same precision as the corresponding DB column before insert/update?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.