NUMERIC and DECIMAL should map to BigDecimal by default, rather than the current mapping of
17-...,? -> BigDecimal
0-16,? -> Double
which causes non-floating pointing numbers to be mapped to floating points number, which should never be used to represent exact values. See
http://stackoverflow.com/questions/28371179/floating-point-types-returned-in-orm-dsl, http://docs.oracle.com/cd/B19306_01/java.102/b14188/datamap.htm, http://www.cs.mun.ca/~michael/java/jdk1.1.5-docs/guide/jdbc/getstart/mapping.doc.html
I agree that this would be valid change and could be applied to the default mappings for numeric types with fractional digits.
@Shredder121 What do you think?
I also think it is a valid change.
As seen in the second link, NUMERIC and DECIMAL should be mapped to BigDecimal.
Ok. I'd still check for the decimal digits though, so the change would be only to get rid of the Double mapping.
@robertandrewbain @Shredder121 Is that ok with you?
@timowest yes, that sounds good.
Yes that sounds good indeed.
Hi! In querydsl version 3.2.4 oracle raw NUMBER datatype (without precision and scale) was mapped to Double, but since version 3.3.0 it maps to BigInteger. Current behavior is incorrect because NUMBER datatype stores fixed and floating-point numbers (http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#CNCPT1832)
Could you tell, please, if this behavior will be fixed after this update?
@borislubimov The behaviour will be fixed in the 3.6.2 and 4.0.0 releases. 3.6.2 will be out at the end of month.
Thank you for quick reply!
@timowest I've just used querydsl-maven-plugin version 3.6.2 (all querydsl packages are at 3.6.2) to generate-sources against an Oracle database. A NUMBER(13,6) is still mapping to a Double. I believed that the changes made to resolve this bug would have meant that a NUMBER(13,6) would map to a BigDecimal. Am I missing anything obvious?
Sorry, the notice above was incorrect, there was only a PR for the 4.* line. Since this change breaks backwards compatibility and the mapping can be easily overriden it was only included in the 4 line.