pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Bad value for type BigDecimal : Y
8+ messages / 4 participants
[nested] [flat]

* Bad value for type BigDecimal : Y
@ 2009-06-11 14:01  Ashish Jain <ashjain2@gmail.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Ashish Jain @ 2009-06-11 14:01 UTC (permalink / raw)
  To: pgsql-jdbc

Hi,

I am using postgresql 8.3 with openJPA 1.2.1. I hit the following error

org.postgresql.util.
PSQLException: Bad value for type BigDecimal : Y
    at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.toBigDecimal(AbstractJdbc2ResultSet.java:2710)
    at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:2133)
    at
org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:311)
    at
org.tranql.connector.jdbc.ResultSetHandle.getBigDecimal(ResultSetHandle.java:179)
    at
org.apache.openjpa.lib.jdbc.DelegatingResultSet.getBigDecimal(DelegatingResultSet.java:282)
    at
org.apache.openjpa.jdbc.sql.DBDictionary.getBigDecimal(DBDictionary.java:389)
    at
org.apache.openjpa.jdbc.sql.PostgresDictionary.getInt(PostgresDictionary.java:210)
    at
org.apache.openjpa.jdbc.sql.DBDictionary.getChar(DBDictionary.java:556)
    at
org.apache.openjpa.jdbc.sql.ResultSetResult.getCharInternal(ResultSetResult.java:288)
    at
org.apache.openjpa.jdbc.sql.ResultSetResult.getObjectInternal(ResultSetResult.java:356)
    at
org.apache.openjpa.jdbc.sql.AbstractResult.getObject(AbstractResult.java:662)
    at
org.apache.openjpa.jdbc.meta.strats.HandlerStrategies.loadDataStore(HandlerStrategies.java:205)
    at
org.apache.openjpa.jdbc.meta.strats.HandlerFieldStrategy.load(HandlerFieldStrategy.java:172)
    at org.apache.openjpa.jdbc.meta.FieldMapping.load(FieldMapping.java:796)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:833)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:785)
    at
org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:453)
    ... 106 more



Please help!!!

Thanks
Ashish

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Bad value for type BigDecimal : Y
@ 2009-06-11 16:30  Richard Broersma <richard.broersma@gmail.com>
  parent: Ashish Jain <ashjain2@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Richard Broersma @ 2009-06-11 16:30 UTC (permalink / raw)
  To: Ashish Jain <ashjain2@gmail.com>; +Cc: pgsql-jdbc

On Thu, Jun 11, 2009 at 7:01 AM, Ashish Jain<ashjain2@gmail.com> wrote:

> I am using postgresql 8.3 with openJPA 1.2.1. I hit the following error
>
> org.postgresql.util.
> PSQLException: Bad value for type BigDecimal : Y     at
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.toBigDecimal(AbstractJdbc2ResultSet.java:2710)

I'm curious what the column definition is for the mapped field that is
defined as a BigDecimal in your JPA ORM.  Is it possible for
PostgreSQL's numeric data to represent values that exceed the limits
of java BigDecimal class?


-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Bad value for type BigDecimal : Y
@ 2009-06-11 16:39  Ashish Jain <ashjain2@gmail.com>
  parent: Richard Broersma <richard.broersma@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Ashish Jain @ 2009-06-11 16:39 UTC (permalink / raw)
  To: Richard Broersma <richard.broersma@gmail.com>; +Cc: pgsql-jdbc

Hi Richard,

Thanks for your reply!!

None of the fields are defind as Big Decimal.I have integer, character and
timestamp as the variable types in my SQL statments
Thanks
Ashish
On Thu, Jun 11, 2009 at 10:00 PM, Richard Broersma <
richard.broersma@gmail.com> wrote:

> On Thu, Jun 11, 2009 at 7:01 AM, Ashish Jain<ashjain2@gmail.com> wrote:
>
> > I am using postgresql 8.3 with openJPA 1.2.1. I hit the following error
> >
> > org.postgresql.util.
> > PSQLException: Bad value for type BigDecimal : Y     at
> >
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.toBigDecimal(AbstractJdbc2ResultSet.java:2710)
>
> I'm curious what the column definition is for the mapped field that is
> defined as a BigDecimal in your JPA ORM.  Is it possible for
> PostgreSQL's numeric data to represent values that exceed the limits
> of java BigDecimal class?
>
>
> --
> Regards,
> Richard Broersma Jr.
>
> Visit the Los Angeles PostgreSQL Users Group (LAPUG)
> http://pugs.postgresql.org/lapug
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Bad value for type BigDecimal : Y
@ 2009-06-11 16:46  Richard Broersma <richard.broersma@gmail.com>
  parent: Ashish Jain <ashjain2@gmail.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Richard Broersma @ 2009-06-11 16:46 UTC (permalink / raw)
  To: Ashish Jain <ashjain2@gmail.com>; +Cc: pgsql-jdbc

On Thu, Jun 11, 2009 at 9:39 AM, Ashish Jain<ashjain2@gmail.com> wrote:

> None of the fields are defind as Big Decimal.I have integer, character and
> timestamp as the variable types in my SQL statments

If your classes do not define BigDecimal as a field and your tables do
not have a numeric data type, it might be very difficult to find the
cause of this error.


-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Bad value for type BigDecimal : Y
@ 2009-06-11 16:52  Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
  parent: Ashish Jain <ashjain2@gmail.com>
  1 sibling, 1 reply; 8+ messages in thread

From: Mikko Tiihonen @ 2009-06-11 16:52 UTC (permalink / raw)
  To: Ashish Jain <ashjain2@gmail.com>; +Cc: pgsql-jdbc

Ashish Jain wrote:
> Hi,
> 
> I am using postgresql 8.3 with openJPA 1.2.1. I hit the following error
> 
> org.postgresql.util.
> PSQLException: Bad value for type BigDecimal : Y
> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:311)
>     at 
> org.tranql.connector.jdbc.ResultSetHandle.getBigDecimal(ResultSetHandle.java:179)
>     at 
> org.apache.openjpa.lib.jdbc.DelegatingResultSet.getBigDecimal(DelegatingResultSet.java:282)
>     at 
> org.apache.openjpa.jdbc.sql.DBDictionary.getBigDecimal(DBDictionary.java:389)
>     at 
> org.apache.openjpa.jdbc.sql.PostgresDictionary.getInt(PostgresDictionary.java:210)
>     at 
> org.apache.openjpa.jdbc.sql.DBDictionary.getChar(DBDictionary.java:556)
>     at 
> org.apache.openjpa.jdbc.sql.ResultSetResult.getCharInternal(ResultSetResult.java:288)

Do you store a boolean 'Y'/'N' in a char(1) column? Maybe openjpa needs to have 
a different mapping that char for it.

-Mikko




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Bad value for type BigDecimal : Y
@ 2009-06-12 06:16  Ashish Jain <ashjain2@gmail.com>
  parent: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Ashish Jain @ 2009-06-12 06:16 UTC (permalink / raw)
  To: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>; richard.broersma@gmail.com; +Cc: pgsql-jdbc

Hi Mikko/Richard,

Thanks for your reply. I do have a column whose length is 1. The definition
goes something like this
@Column(updatable=true, name="st_spom_status", nullable=false, length=1)
  private String status;

Do you think this is what may be the cause of the problem??

Thanks
Ashish

On Thu, Jun 11, 2009 at 10:22 PM, Mikko Tiihonen <
mikko.tiihonen@nitorcreations.com> wrote:

> Ashish Jain wrote:
>
>> Hi,
>>
>> I am using postgresql 8.3 with openJPA 1.2.1. I hit the following error
>>
>> org.postgresql.util.
>> PSQLException: Bad value for type BigDecimal : Y
>>
>> org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBigDecimal(AbstractJdbc2ResultSet.java:311)
>>    at
>> org.tranql.connector.jdbc.ResultSetHandle.getBigDecimal(ResultSetHandle.java:179)
>>    at
>> org.apache.openjpa.lib.jdbc.DelegatingResultSet.getBigDecimal(DelegatingResultSet.java:282)
>>    at
>> org.apache.openjpa.jdbc.sql.DBDictionary.getBigDecimal(DBDictionary.java:389)
>>    at
>> org.apache.openjpa.jdbc.sql.PostgresDictionary.getInt(PostgresDictionary.java:210)
>>    at
>> org.apache.openjpa.jdbc.sql.DBDictionary.getChar(DBDictionary.java:556)
>>    at
>> org.apache.openjpa.jdbc.sql.ResultSetResult.getCharInternal(ResultSetResult.java:288)
>>
>
> Do you store a boolean 'Y'/'N' in a char(1) column? Maybe openjpa needs to
> have a different mapping that char for it.
>
> -Mikko
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Bad value for type BigDecimal : Y
@ 2009-06-12 07:42  John Lister <john.lister@kickstone.com>
  parent: Ashish Jain <ashjain2@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: John Lister @ 2009-06-12 07:42 UTC (permalink / raw)
  To: Ashish Jain <ashjain2@gmail.com>; +Cc: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>; richard.broersma@gmail.com; pgsql-jdbc

Ashish Jain wrote:
> Hi Mikko/Richard,
>  
> Thanks for your reply. I do have a column whose length is 1. The 
> definition goes something like this
> @Column(updatable=true, name="st_spom_status", nullable=false, length=1)
>   private String status;
>  
> Do you think this is what may be the cause of the problem??
>  
My first guess is that you have a column defined as a bigdecimal in your 
jpa object but it is actually a string in the database one of whose rows 
contains the value 'Y'.

JOHN




^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Bad value for type BigDecimal : Y
@ 2009-06-16 08:22  Ashish Jain <ashjain2@gmail.com>
  parent: John Lister <john.lister@kickstone.com>
  0 siblings, 0 replies; 8+ messages in thread

From: Ashish Jain @ 2009-06-16 08:22 UTC (permalink / raw)
  To: John Lister <john.lister@kickstone.com>; +Cc: Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>; richard.broersma@gmail.com; pgsql-jdbc

John/Mikko/Richard,

Thanks a lot for all your help on this issue.
I was able to resolve this problem by setting the following property
<property name="openjpa.jdbc.DBDictionary"
value="postgres(StoreCharsAsNumbers=false)"/>

Thanks
Ashish

On Fri, Jun 12, 2009 at 1:12 PM, John Lister <john.lister@kickstone.com>wrote:

> Ashish Jain wrote:
>
>> Hi Mikko/Richard,
>>  Thanks for your reply. I do have a column whose length is 1. The
>> definition goes something like this
>> @Column(updatable=true, name="st_spom_status", nullable=false, length=1)
>>  private String status;
>>  Do you think this is what may be the cause of the problem??
>>
>>
> My first guess is that you have a column defined as a bigdecimal in your
> jpa object but it is actually a string in the database one of whose rows
> contains the value 'Y'.
>
> JOHN
>
>

^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2009-06-16 08:22 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-06-11 14:01 Bad value for type BigDecimal : Y Ashish Jain <ashjain2@gmail.com>
2009-06-11 16:30 ` Richard Broersma <richard.broersma@gmail.com>
2009-06-11 16:39   ` Ashish Jain <ashjain2@gmail.com>
2009-06-11 16:46     ` Richard Broersma <richard.broersma@gmail.com>
2009-06-11 16:52 ` Mikko Tiihonen <mikko.tiihonen@nitorcreations.com>
2009-06-12 06:16   ` Ashish Jain <ashjain2@gmail.com>
2009-06-12 07:42     ` John Lister <john.lister@kickstone.com>
2009-06-16 08:22       ` Ashish Jain <ashjain2@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox