|Mapping the JDBC data type NUMERIC to a Java data type in Scout [message #968564]
||Fri, 02 November 2012 15:01
| Beat Schwarzentrub
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 ), 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
Mapped Java-Type: java.lang.Double
- Value in database: 1.0
Mapped Java-Type: java.lang.Long
Relevant code locations:
* 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?
 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
Powered by FUDForum
. Page generated in 0.02205 seconds