Simo
Simo

Reputation: 828

Handle money value

I have to make a program in grails that have to handle money value, I would like to know if is better save in the db all the money in a unique value (ex: EUR) or if is better to save the money with the value that th user give me, and i would also like to know if exist API that convert money values.

Thank you very much anyway!

Upvotes: 0

Views: 291

Answers (1)

mabi
mabi

Reputation: 5306

Have a look at timeandmoney library with grails which rightly suggests joda money to do the job.

Much more knowledgeable folks suggest using your database' bigdecimal equivalent as the underlying storage type. This implies storing it all in a "base" currency and converting on the fly. For that, you can fetch currency exchange rates from the interweb. I've seen http://grails.org/plugin/exchange-rates but haven't tried it, yet.

Upvotes: 1

Related Questions