Gavin King (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16650 (
https://hibernate.atlassian.net/browse/HHH-16650?atlOrigin=eyJpIjoiMDU3MT...
)
Re: Loss in precision due usage of Float data type instead of BigDecimal in case Oracle
JDBC driver returning -127 for scale and 0 for precision if precision/scale is unknown.
Might happen unexpectedly and requires very close inspection of used SQL (
https://hibernate.atlassian.net/browse/HHH-16650?atlOrigin=eyJpIjoiMDU3MT...
)
OK, thanks, so, conclusion:
* This only happens in quite specific circumstances (selecting numeric literals, it seems)
where for some reason Oracle is unable to assign a proper type to the literal, and it
reports the scale as -127. It does not appear to occur when just selecting columns.
* This tripped up our workaround for a different bug where Oracle never correctly reports
the type of FLOAT / DOUBLE PRECISION columns. We were using a scale of -127 to detect the
FLOAT type, since Oracle always incorrectly reports it as NUMBER. But this turns out to be
fragile (no surprise).
* And, so, in cases of types with more than 15 digits of precision, this could lead to
truncation of the least-significant digits. Now, it’s worth keeping in mind that more than
15 decimal digits of precision is incredibly rare in real world data.
My proposed fix is here:
https://github.com/hibernate/hibernate-orm/pull/6613/commits/55bc38dede84...
(
https://hibernate.atlassian.net/browse/HHH-16650#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16650#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100225- sha1:9dd72a2 )