Search code examples
javasap-commerce-cloudbigdecimal

Decimal separator gets removed in Backoffice


We are using SAP Commerce 2011 and we are facing an anomaly about decimal separator in backoffice.

Our case is the following one: we have created a java.lang.Double attribute to manage decimal values but seems doesn't work; i.e., when we add a value equal to 3,5 the final output is 4 (after the saving).

We have tried changing the attribute type from java.lang.Double to java.lang.BigDecimal or adding persistence-type="decimal(30,8)" but it doesn't work yet.

Is there a way to fix that?


Solution

  • If you have done an update system to persist your item type definition into the database already, changing your item type definition won't work. Hybris doesn't do anything around removing tables/columns and recreating them in the db. Even if you deleted the attribute from your items.xml it will remain in the database. So there is no good automated support for that.

    What you could do is mostly manual steps like e.g.:

    1. change your item type definition (in your items.xml file) to use BigDecimal
    2. via backoffice: manually remove the existing (old) definition in the type system
    3. remove the column from your database
    4. rebuild ("ant clean all" to recreate all Model classes etc with the new definition)
    5. run update system in hybris.