db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kathey Marsden <kmarsdende...@sbcglobal.net>
Subject Re: ResultSet.getObject(int) for SMALLINT returns Integer, not Short
Date Tue, 26 Jul 2011 21:28:33 GMT
On 7/26/2011 1:30 PM, Pavel Bortnovskiy wrote:
> Thank you, Knut, for your prompt response.
> However, such asymmetry (java.lang.Short->SMALLINT->java.lang.Integer) 
> is causing trouble in my code and will require inefficient type 
> checking to override such behavior.

I don't know if any of this will be helpful to you, but  in case ..

1) To achieve more symmetry  it is fine to use an Integer object with 
setObject() on a SMALLINT column.

2) ResultSetMetaData() regColumnClassName(int column) returns the class 
that will be returned with getObject()

3) If performance/efficiency  is a concern I think it is typically best 
to stay away from getObject() and setObject() use get/setShort() instead.


View raw message