|
If you run the following query (here within J2EE context, but same result if executed standalone), the returned object will be of type “BigDecimal” (as expected):
However, if you run the query mentioned in my initial post, the returned object will be of type Float, causing the value from table “testTable” to get truncated in terms of precision:
You can also reproduce the issue without using a table, e.g., using the following query:
If seems that the Oracle JDBC driver generally returns a value of “-127” for method "getScale()" and a value of “0” for method "getPrecision()" (on “OracleResultSetMetaData”) in case the scale and the precision of a returned numeric column is unknown. In such case Hibernate chooses a data type of “Float” which may cause loss of precision. Sorry that my initial post sound too offensive, that was not my intention. Sorry! Bye, Ralf |