Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Mapping the JDBC data type NUMERIC to a Java data type in Scout
Mapping the JDBC data type NUMERIC to a Java data type in Scout [message #968564] Fri, 02 November 2012 15:01 Go to next message
Beat Schwarzentrub is currently offline Beat SchwarzentrubFriend
Messages: 92
Registered: November 2010

When a database query is executed from Scout, the appropriate SQL style is used to map the resulting data from JDBC data types to Java data types.

In my example, I have an Oracle database with a column of type NUMBER(15,5). Apparently, the JDBC data type is Types.NUMERIC (seems correct, see [1]), which is mapped by Scout's AbstractSqlStyle to either java.lang.Double or java.lang.Long (depending on the number's scale)! This may result in an Object[][] that does not have equal datatypes on all rows! Example:

  • Value in database: 1.5
    JDBC-Type: Types.NUMERIC
    Mapped Java-Type: java.lang.Double
  • Value in database: 1.0
    JDBC-Type: Types.NUMERIC
    Mapped Java-Type: java.lang.Long

Relevant code locations:
*, ResultSetMetaData, int, int)

This seems wrong to me. In the database all rows have an identical data type for a specific column, so I would assume that the resulting Java data types are equal, too. Mixing data types can lead to problems, e.g. when I want to use the MatrixUtility to sort an Object[][].

Can you explain the reasons for the described behaviour to me?

Kind regards,

[1] -> chapter 8.3.1

[Updated on: Fri, 02 November 2012 15:04]

Report message to a moderator

Re: Mapping the JDBC data type NUMERIC to a Java data type in Scout [message #987127 is a reply to message #968564] Fri, 23 November 2012 16:28 Go to previous message
Judith Gull is currently offline Judith GullFriend
Messages: 75
Registered: February 2010
I aggree, it should be the same data type in each row. I created bug to track this.

Previous Topic:SVN checkout
Next Topic:Page and form lifecycles
Goto Forum:

Current Time: Wed May 23 11:20:04 GMT 2018

Powered by FUDForum. Page generated in 0.01853 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top