Re: Require assistance in Postgres + Hibernate : Error: java.math.BigInteger cannot be cast to java.math.BigDecimal

From: rob stone <floriparob(at)gmail(dot)com>
To: Vinodh NV <linktovinodh(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Require assistance in Postgres + Hibernate : Error: java.math.BigInteger cannot be cast to java.math.BigDecimal
Date: 2018-02-13 11:39:36
Message-ID: 1518521976.11296.1.camel@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

On Tue, 2018-02-13 at 14:28 +0530, Vinodh NV wrote:
> Hi,
>
> Require assistance on the below:
>
> Code snippet:
> Map<String,Object> ic;
> //Populate values for ic
> long count = ((BigDecimal)ic.get(“EB”)).longValue();
>
>
> Getting the below error:
> java.math.BigInteger cannot be cast to java.math.BigDecimal
> ®java.lang.ClassCastException: java.math.BigInteger cannot be
> cast to java.math.BigDecimal
>
> Since this is not part of a query doing select cast (EB as bigint)
> will not help in this case:
>
> Can u let me know the solution for this?
>
> Regards,
> Vinodh

This is not a Postgres question per se.

The method is documented as:-

public static BigDecimal valueOf(long val)

HTH,
Rob

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Francisco Olarte 2018-02-13 11:41:04 Re: Require assistance in Postgres + Hibernate : Error: java.math.BigInteger cannot be cast to java.math.BigDecimal
Previous Message Luca Ferrari 2018-02-13 10:03:01 Re: session_replication_role meaning?