Skip site navigation (1) Skip section navigation (2)

Re: Integer is not a subclass of Short

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Lloyd Parkes <Lloyd(dot)Parkes(at)ecs(dot)vuw(dot)ac(dot)nz>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Integer is not a subclass of Short
Date: 2010-07-29 23:51:04
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
Lloyd Parkes wrote:
> Hi all,
> I have found a problem with a discrepancy between getColumnClassName()
> in jdbc/pgjdbc/org/postgresql/jdbc2/
> and internalGetObject() in
> jdbc/pgjdbc/org/postgresql/jdbc2/
> The former is defined (indirectly) to return the fully qualified class
> name of (a possible superclass of) the object returned by the latter.
> For a smallint column, the former returns "java.lang.Short", but the
> latter returns a java.lang.Integer. Short is neither Integer, nor a
> superclass of Integer.
> I guess someone should add the line "return new
> Short(getShort(columnIndex));" between lines 123 and 124 of rev 1.108 of
> There may be a similar problem with tinyint
> columns, but I don't have any tinyint columns.

getObject() on a smallint column is correct to return an Integer (see
table B-3 in the JDBC spec), so if the metadata method is claiming it
should be a Short, then it's the metadata method that's wrong.

That said, I think you must be using a very old driver. The last time I
can see TypeInfoCache mapping int2 to "java.lang.Short" is back in the
8.1 driver branch. 8.2 and later should return "java.lang.Integer".


In response to


pgsql-jdbc by date

Next:From: Craig RingerDate: 2010-07-30 07:22:37
Subject: Re: JPA and desktop apps
Previous:From: Kris JurkaDate: 2010-07-29 23:50:37
Subject: Re: Integer is not a subclass of Short

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group