Mapping Java BigDecimal

Lists: pgsql-general
From: Jakub Bednář <jakub(dot)bednar(at)b2bcentrum(dot)cz>
To: pgsql-general(at)postgresql(dot)org
Subject: Mapping Java BigDecimal
Date: 2010-01-18 08:19:40
Message-ID: 4B54199C.5020905@b2bcentrum.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Hi All,

We decide add support PostgreSQL database (now supporting only Oracle
database) to our product.

In Oracle we mapping Java BigDecimal to number(19, 2), in PostgreSQL to
numeric(19, 2).

If I store to "BigDecimal column" number without decimal, e.g. "3", than
Oracle JDBC driver return "3", but PostgreSQL JDBC driver return "3.00".

Is there some way (mapping, server setup,...) how reach return number
without trailing zeroes on decimal position?

I'm using PostgreSQL v. 8.1.18 (default for CentoOS 5.3).
Thank you all

----

Jakub Bednar


From: Lew <noone(at)lwsc(dot)ehost-services(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Mapping Java BigDecimal
Date: 2010-01-23 18:20:43
Message-ID: hjfelt$ke8$1@news.albasani.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Jakub Bednář wrote:
> Hi All,
>
> We decide add support PostgreSQL database (now supporting only Oracle
> database) to our product.
>
> In Oracle we mapping Java BigDecimal to number(19, 2), in PostgreSQL to
> numeric(19, 2).
>
> If I store to "BigDecimal column" number without decimal, e.g. "3", than
> Oracle JDBC driver return "3", but PostgreSQL JDBC driver return "3.00".
>
> Is there some way (mapping, server setup,...) how reach return number
> without trailing zeroes on decimal position?

There's no difference between those two values in Java's BigDecimal.

Are you saying that the 'scale' of the returned values differs between the
JDBC for Oracle and that for PG?

--
Lew