When I need to retrieve some information in Order table, jasper cannot cast from PGmoney to double. I searched google first, but no have result of this.
You know how to fix it?
Note: I use PostgreSQL database.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is one of the several reasons the PostgreSQL
moneytype was deprecated and should be avoided. Oddly newer versions of the same documentation don’t show the deprecation warning but I and others disagree with that and think its use should be discouraged.If at all possible, change your schema to use
numericinstead, likenumeric(17,2)if you only want to store whole-number cents, or something more precise for intermediate values. You’ll have a nightmare of a time working withmoneyin HQL, to the point where even Java’sBigDecimalclass (usually used to mapnumericfields) is better despite the awfully clumsy syntax of itsw arithmetic.I’d do an
ALTER TABLE blah ALTER COLUMN blahcol TYPE numeric(17,2) USING ( regexp_replace(blahcol::text, '[$,]', '', 'g')::numeric );and forget themoneytype existed if I were you.