aspose file tools*
The moose likes Groovy and the fly likes Dealing with money in Grails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Dealing with money in Grails" Watch "Dealing with money in Grails" New topic
Author

Dealing with money in Grails

Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

Hey,
Our domain classes use Double class to present money bids.
AFAIK, money values should be saved as BigDecimal right?
I can refactor the data type to BigDecimal (and update the database schema of course) but should I expect errors from views?
BTW, I'm using this tag to format money:
<g:formatNumber number="${equipementInstance?.cost}" type="currency" currencyCode="USD"/>
But no currency code is shown, neither delimiters.
Am I missing something?
OSX 10.6.2
Grails 1.1.1
Thanks for help and time.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

As a quick test I just did the following:



And my output was: $12.23

So I'm not sure what's going on, on your side of things.


GenRocket - A Test Data Generation Platform
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

It is not working on Grails 1.1.1 but it does for Grails 1.2+
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15286
    
    6

John Todd wrote:It is not working on Grails 1.1.1 but it does for Grails 1.2+


Time to upgrade. ;)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dealing with money in Grails
 
Similar Threads
calculating sum for numeric(currency) columns and displaying it with currency code in a JTable
Cannot store money value from Resultset
Double addition gives wrong result?
Handling currency throughout an application
Precision loss in String to Float and double to float