We are just calling the standard JDBC API ResultSet.getObject().
Then we apply a huge number of workarounds for various known database bugs. But none of those workarounds involve up-conversion from Long to BigInteger, Double to BigDecimal or anything of the kind - it's the JDBC driver's choice to return those types.
Announcement
Collapse
No announcement yet.
X
-
Hi Isomorphic,
Originally posted by Blama View PostThese docs might be interesting in this context:
Originally posted by Oracle DocsNUMBER Types
For the different type codes that an Oracle NUMBER value can correspond to, call the getter routine that is appropriate for the size of the data for mapping to work properly. For example, call getByte to get a Java tinyint value for an item x, where -128 < x < 128.
If you know that it works it is fine and I'll try to get rid of my BigDecimals, but otherwise I'll wait for your suggestion of a best practice.
Best regards
Blama
Leave a comment:
-
Originally posted by Blama View PostInformation (without reason) that SQL INTEGER not always will result in NUMBER(10,0), but can result in NUMBER(38,0) (when used in a DDL statement). This happens for me.
But this is not related to the JDBC question anymore. I'll try with explicit NUMBER(p,0) in my DDL and see what result I get in Java. If you know of the current reference (see #7), please let me know.
Best regards
Blama
Leave a comment:
-
Hi Isomorphic,
Originally posted by Isomorphic View PostThe JDBC driver, and we're not sure of that table - Oracle tends to change their JDBC driver's behavior from time to time unfortunately.
Best regards
Blama
Leave a comment:
-
These docs might be interesting in this context:
- Oracle 11.2 Database JDBC Developer's Guide: Data Type Mappings
- Information (without reason) that SQL INTEGER not always will result in NUMBER(10,0), but can result in NUMBER(38,0) (when used in a DDL statement). This happens for me.
I'll try in a test what different SQL / Oracle NUMBER types will give me in Java/DMI and decide then how to proceed. The BigDecimal-casting is annoying and it will take long until Java Integer or Long won't fit my primaryKey-needs anymore :)
Best regards
BlamaLast edited by Blama; 22 Jul 2015, 03:03.
Leave a comment:
-
The JDBC driver, and we're not sure of that table - Oracle tends to change their JDBC driver's behavior from time to time unfortunately.
Leave a comment:
-
Hi Isomorphic
Originally posted by Isomorphic View PostTo avoid receiving these types in Java, the best fix is to modify your database schema so you are using types that only represent the range you are actually using. This can reduce your storage needs and speed up your database queries too.
Is the following correct? Up to...:- Oracle NUMBER(4,0) -> Java Short
- Oracle NUMBER(9,0) -> Java Integer
- Oracle NUMBER(18,0) -> Java Long
- Oracle NUMBER(38,0) -> Java BigDecimal
Who does this conversion? Is it SmartGWT or the ODBC driver?
Best regards
Blama
Leave a comment:
-
When you use these database column types, the JDBC driver returns BigDecimal and BigInteger types because it's possible to store numbers that are bigger than Java's Double or Long types can represent.
The docs (same that Blama linked to) describe what we do when delivering to the browser, which really can't represent such values at all.
To avoid receiving these types in Java, the best fix is to modify your database schema so you are using types that only represent the range you are actually using. This can reduce your storage needs and speed up your database queries too.
Leave a comment:
-
Hi wwarriner,
please read this thread and these linked 5.1d(!) docs.
My guess after reading this is that for values in the Java Integer and Long range you should be getting Java Integers and Longs (@Isomorphic: or always Longs?).
@Isomorphic:
I have to cast from BigInteger also all the time and it would be great if this could be transparently done by SmartGWT (currently I'm using 5.0p). This docs read as small values should never be BigInteger in DMI. Is this true? Also for results from server initiated fetches? If so (and the docs suggest this), I'm pretty sure that the framework is behaving different than it should. I can give you a testcase for Oracle type NOT NULL NUMBER(38) and DSField type="integer" then (using ojdbc6.jar).
Best regards
Blama
Leave a comment:
-
Is there any support for Oracle Number type
SmartClient Version: v9.1p_2014-03-18/Pro Deployment (built 2014-03-18)
I have a oracle data source with columns of type NUMBER. In the ds.xml file I define these fields as floats. On the server side I query and the type of the returned associated column value is BigDecimal.
Is it up to application convert the BigDecimal to float or does smartgwt provide some kind of support for this ?Tags: None
Leave a comment: