persistence@glassfish.java.net

Issue with Derby driver when trying to do a getFloat() where the row has FLOAT.MAX_VALUE

From: Pramod Gopinath <Pramod.Gopinath_at_Sun.COM>
Date: Wed, 08 Mar 2006 19:38:50 -0800

Hi Lance
  While researching an issue (#56), found this issue and wanted to get
your input on it.
I have a table created in the Derby database with a field as "float". I
am able to successfully insert into this field the value FLOAT.MAX_VALUE
(3.4028235E38). But when I try to query this field and try to use
resultSet.getFloat() to retrieve this value I get a SQLException thrown.
The derby driver that I am using is the one that is part of our
Glassfish 9.0 build.
The stack trace is :
 org.apache.derby.client.am.LossOfPrecisionConversionException: Invalid
data conversion:Requested conversion would result in a loss of precision
of 3.4028235E38
        at
org.apache.derby.client.am.CrossConverters.getFloatFromDouble(Unknown
Source)
        at org.apache.derby.client.am.Cursor.getFloat(Unknown Source)
        at org.apache.derby.client.am.ResultSet.getFloat(Unknown Source)
        at DerbyFloat.testFloat(DerbyFloat.java:121)
        at DerbyFloat.main(DerbyFloat.java:139)

I have attached a simple java program that I have used to reproduce this
problem.

Thanks
Pramod