FAQ
it doesn't look like cayenne 2.0.4 will read a decimal database type into a java Float. Is that correct? Originally I had the database type as float and persistence worked fine but then I converted all the database fields to decimal(10,2) - a better representation of money values than the float type - but now the persistence acts like everything works fine but the values don't actually read/write to the database.

I guess my question then, is what is the best way to handle money values on the db type and the java type?

thanks in advance.
Chad

Search Discussions

  • Aristedes Maniatis at Mar 12, 2009 at 10:37 pm

    On 13/03/2009, at 2:55 AM, Chad Smith wrote:

    I guess my question then, is what is the best way to handle money
    values on the db type and the java type?

    BigDecimal in Java and DECIMAL in the database. Floating point numbers
    are evil with respect to money since they are only approximations of
    decimal numbers: I'm sure your tax office would appreciate that note
    on your return stating 'all numbers are approximations only' :-)

    Ari Maniatis


    -------------------------->
    ish
    http://www.ish.com.au
    Level 1, 30 Wilson Street Newtown 2042 Australia
    phone +61 2 9550 5001 fax +61 2 9550 4001
    GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedMar 12, '09 at 3:56p
activeMar 12, '09 at 10:37p
posts2
users2
websitecayenne.apache.org

2 users in discussion

Aristedes Maniatis: 1 post Chad Smith: 1 post

People

Translate

site design / logo © 2022 Grokbase