Thread: BUG #8389: JDBC Driver assumes first column to be an integer

BUG #8389: JDBC Driver assumes first column to be an integer

From
ivan.pli@solidit.cl
Date:
The following bug has been logged on the website:

Bug reference:      8389
Logged by:          Ivan Pliouchtchai
Email address:      ivan.pli@solidit.cl
PostgreSQL version: 9.2.4
Operating system:   Windows 7
Description:

PRECONDITION:
When having a table with the next columns:
content varchar(10)
idcontent int primary key


ACTION:
Persisting a row using the JDBC driver (I used JBoss and hibernate to
persist a bean)




RESULT:
The JDBC driver throws an exception while trying to parse the first column
content (a string) as an integer.


Anyway the content gets saved to the database.


TEMPORARY SOLUTION:
Recreating the table with the integer key column as the first column solved
the problem.

Re: BUG #8389: JDBC Driver assumes first column to be an integer

From
Kevin Grittner
Date:
"ivan.pli@solidit.cl" <ivan.pli@solidit.cl> wrote:=0A=0A> When having a tab=
le with the next columns:=0A> content varchar(10)=0A> idcontent int primary=
 key=0A=0A> Persisting a row using the JDBC driver (I used JBoss and=0A> hi=
bernate to persist a bean)=0A=0A> The JDBC driver throws an exception while=
 trying to parse the=0A> first column content (a string) as an integer.=0A=
=0AI think the behavior you are seeing is due to JBoss or Hibernate. =0AI'v=
e used many tables with no integer columns through PostgreSQL=0AJDBC.=A0 Hi=
bernate, by default, seems to want every table to have a=0Aprimary key of a=
 single integer column, it but can be coerced to=0Awork with a properly nor=
malized relational database with a little=0Aeffort.=A0 In my experience it'=
s worth the effort.=0A=0A--=0AKevin Grittner=0AEDB: http://www.enterprisedb=
.com=0AThe Enterprise PostgreSQL Company