Skip to content

Conversion from mysql decimal column to curreny YEN fails. #95

@runkelstein

Description

@runkelstein

Hey Folks,

for an application we are using hibernate as ORM MApper and jadira for the conversion into java types.

We are converting from a mysql column decimal(19,2) into Yoda Money.

Our billing application now needs to support YEN. To all the currencies so far there is one crucial difference:

YEN does not have decimal places. Still it makes sense to store all the amounts into the same columns.

image

When you look at the code of yoda money, you see that yoda money will throw an exception if a big decimal with decimal points is provided.

The jadira converter (PersistentMoneyAmountAndCurrency) looks like this:

image

Now mysql will store for instance the amount '0' as '0.00' in the database. When converting to bigdecimal this value now has a scale. I think it is fixable by changing the code in the method "fromConvertedColumns".

For now I will just duplicate this class and make these changes myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions