Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 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: 205
Registered: November 2010
Senior Member
Hello

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:
* org.eclipse.scout.rt.server.services.common.jdbc.internal.exec.StatementProcessor.processResultRow(ResultSet)
* org.eclipse.scout.rt.server.services.common.jdbc.style.AbstractSqlStyle.readBind(ResultSet, 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,
Beat

[1] http://docs.oracle.com/javase/1.5.0/docs/guide/jdbc/getstart/mapping.html -> 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
Member
I aggree, it should be the same data type in each row. I created bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=394984 to track this.

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


Current Time: Wed Apr 24 23:02:42 GMT 2024

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

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

Back to the top