[jira] [Commented] (OPENJPA-2671) Wrong type mapping for double in HSQLDB
[ https://issues.apache.org/jira/browse/OPENJPA-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15575879#comment-15575879 ] Mark Struberg commented on OPENJPA-2671: Indeed, if I add the lines above to your test then it works fine. Here is the final persistence.xml I did use in the test: {code} http://xmlns.jcp.org/xml/ns/persistence; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd;> testHsqldbDouble.TestEntity {code} > Wrong type mapping for double in HSQLDB > --- > > Key: OPENJPA-2671 > URL: https://issues.apache.org/jira/browse/OPENJPA-2671 > Project: OpenJPA > Issue Type: Bug > Components: jdbc >Affects Versions: 2.4.1 >Reporter: Andreas Borg > Attachments: testHsqldbDouble.zip > > > Currently, Java type {{double}} is mapped to {{NUMERIC}} for HSQLDB: > {code:title=HSQLDictionary.java, line 82|borderStyle=solid} >doubleTypeName = "NUMERIC"; > {code} > (see > https://fisheye6.atlassian.com/browse/~tag=2.4.1/openjpa/tags/2.4.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?hb=true). > This seems wrong to me, as HSQLDB's {{NUMERIC}} is not a binary floating > point type, but represents exact decimal numbers and maps to Java type > {{BigDecimal}} (see HSQL documentation: > http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types). The > corresponding HSQL type for {{double}} is, according to this manual, > {{REAL}}, {{FLOAT}} or {{DOUBLE}} (all being equivalent). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (OPENJPA-2671) Wrong type mapping for double in HSQLDB
[ https://issues.apache.org/jira/browse/OPENJPA-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15575475#comment-15575475 ] Mark Struberg commented on OPENJPA-2671: I see. That is most probably because DOUBLE is kind of binary stored whereas NUMBER is a fixed precision decimal. I agree that DOUBLE is a better fit, but am a bit frightened that we might introduce a backward incompatibility for where it did work fine. There is a trick which you can use and we still don't loose backward compatibility for other users: You can tweak each DBDictionary in your persistence.xml Please try the following: {code} ... ... {code} > Wrong type mapping for double in HSQLDB > --- > > Key: OPENJPA-2671 > URL: https://issues.apache.org/jira/browse/OPENJPA-2671 > Project: OpenJPA > Issue Type: Bug > Components: jdbc >Affects Versions: 2.4.1 >Reporter: Andreas Borg > Attachments: testHsqldbDouble.zip > > > Currently, Java type {{double}} is mapped to {{NUMERIC}} for HSQLDB: > {code:title=HSQLDictionary.java, line 82|borderStyle=solid} >doubleTypeName = "NUMERIC"; > {code} > (see > https://fisheye6.atlassian.com/browse/~tag=2.4.1/openjpa/tags/2.4.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?hb=true). > This seems wrong to me, as HSQLDB's {{NUMERIC}} is not a binary floating > point type, but represents exact decimal numbers and maps to Java type > {{BigDecimal}} (see HSQL documentation: > http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types). The > corresponding HSQL type for {{double}} is, according to this manual, > {{REAL}}, {{FLOAT}} or {{DOUBLE}} (all being equivalent). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (OPENJPA-2671) Wrong type mapping for double in HSQLDB
[ https://issues.apache.org/jira/browse/OPENJPA-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15575455#comment-15575455 ] Andreas Borg commented on OPENJPA-2671: --- I am using HSQLDB 2.3.3. Our specific problem is that {{Double.NEGATIVE_INFINITY}} (this probably also applies to {{POSITIVE-INFINITY}}) cannot be saved when a {{NUMERIC}} column is used (HSQL raises an exception saying "numeric value out of range". This problem does not ocur when enforcing a {{DOUBLE}} column by annotating {{@Column(columnDefinition = "DOUBLE")}}. I have attached test code (executable with {{mvn test}}), which reproduces this error and demonstrates that it does not occur with mapping to database type {{DOUBLE}}. > Wrong type mapping for double in HSQLDB > --- > > Key: OPENJPA-2671 > URL: https://issues.apache.org/jira/browse/OPENJPA-2671 > Project: OpenJPA > Issue Type: Bug > Components: jdbc >Affects Versions: 2.4.1 >Reporter: Andreas Borg > Attachments: testHsqldbDouble.zip > > > Currently, Java type {{double}} is mapped to {{NUMERIC}} for HSQLDB: > {code:title=HSQLDictionary.java, line 82|borderStyle=solid} >doubleTypeName = "NUMERIC"; > {code} > (see > https://fisheye6.atlassian.com/browse/~tag=2.4.1/openjpa/tags/2.4.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?hb=true). > This seems wrong to me, as HSQLDB's {{NUMERIC}} is not a binary floating > point type, but represents exact decimal numbers and maps to Java type > {{BigDecimal}} (see HSQL documentation: > http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types). The > corresponding HSQL type for {{double}} is, according to this manual, > {{REAL}}, {{FLOAT}} or {{DOUBLE}} (all being equivalent). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Comment Edited] (OPENJPA-2671) Wrong type mapping for double in HSQLDB
[ https://issues.apache.org/jira/browse/OPENJPA-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15575444#comment-15575444 ] Andreas Borg edited comment on OPENJPA-2671 at 10/14/16 2:12 PM: - Attached test code raising an exception when trying to store Double.NEGATIVE_INFINITY into HSQLDB with default type mapping. was (Author: andreasborg): Test code raising an exception when trying to store Double.NEGATIVE_INFINITY into HSQLDB with default type mapping. > Wrong type mapping for double in HSQLDB > --- > > Key: OPENJPA-2671 > URL: https://issues.apache.org/jira/browse/OPENJPA-2671 > Project: OpenJPA > Issue Type: Bug > Components: jdbc >Affects Versions: 2.4.1 >Reporter: Andreas Borg > Attachments: testHsqldbDouble.zip > > > Currently, Java type {{double}} is mapped to {{NUMERIC}} for HSQLDB: > {code:title=HSQLDictionary.java, line 82|borderStyle=solid} >doubleTypeName = "NUMERIC"; > {code} > (see > https://fisheye6.atlassian.com/browse/~tag=2.4.1/openjpa/tags/2.4.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?hb=true). > This seems wrong to me, as HSQLDB's {{NUMERIC}} is not a binary floating > point type, but represents exact decimal numbers and maps to Java type > {{BigDecimal}} (see HSQL documentation: > http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types). The > corresponding HSQL type for {{double}} is, according to this manual, > {{REAL}}, {{FLOAT}} or {{DOUBLE}} (all being equivalent). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (OPENJPA-2671) Wrong type mapping for double in HSQLDB
[ https://issues.apache.org/jira/browse/OPENJPA-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Andreas Borg updated OPENJPA-2671: -- Attachment: testHsqldbDouble.zip Test code raising an exception when trying to store Double.NEGATIVE_INFINITY into HSQLDB with default type mapping. > Wrong type mapping for double in HSQLDB > --- > > Key: OPENJPA-2671 > URL: https://issues.apache.org/jira/browse/OPENJPA-2671 > Project: OpenJPA > Issue Type: Bug > Components: jdbc >Affects Versions: 2.4.1 >Reporter: Andreas Borg > Attachments: testHsqldbDouble.zip > > > Currently, Java type {{double}} is mapped to {{NUMERIC}} for HSQLDB: > {code:title=HSQLDictionary.java, line 82|borderStyle=solid} >doubleTypeName = "NUMERIC"; > {code} > (see > https://fisheye6.atlassian.com/browse/~tag=2.4.1/openjpa/tags/2.4.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?hb=true). > This seems wrong to me, as HSQLDB's {{NUMERIC}} is not a binary floating > point type, but represents exact decimal numbers and maps to Java type > {{BigDecimal}} (see HSQL documentation: > http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types). The > corresponding HSQL type for {{double}} is, according to this manual, > {{REAL}}, {{FLOAT}} or {{DOUBLE}} (all being equivalent). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (OPENJPA-2671) Wrong type mapping for double in HSQLDB
[ https://issues.apache.org/jira/browse/OPENJPA-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15575222#comment-15575222 ] Romain Manni-Bucau commented on OPENJPA-2671: - for which version? IIRC hsqldb 2.3.2 was ok with numeric. > Wrong type mapping for double in HSQLDB > --- > > Key: OPENJPA-2671 > URL: https://issues.apache.org/jira/browse/OPENJPA-2671 > Project: OpenJPA > Issue Type: Bug > Components: jdbc >Affects Versions: 2.4.1 >Reporter: Andreas Borg > > Currently, Java type {{double}} is mapped to {{NUMERIC}} for HSQLDB: > {code:title=HSQLDictionary.java, line 82|borderStyle=solid} >doubleTypeName = "NUMERIC"; > {code} > (see > https://fisheye6.atlassian.com/browse/~tag=2.4.1/openjpa/tags/2.4.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?hb=true). > This seems wrong to me, as HSQLDB's {{NUMERIC}} is not a binary floating > point type, but represents exact decimal numbers and maps to Java type > {{BigDecimal}} (see HSQL documentation: > http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types). The > corresponding HSQL type for {{double}} is, according to this manual, > {{REAL}}, {{FLOAT}} or {{DOUBLE}} (all being equivalent). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (OPENJPA-2671) Wrong type mapping for double in HSQLDB
[ https://issues.apache.org/jira/browse/OPENJPA-2671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15575178#comment-15575178 ] Mark Struberg commented on OPENJPA-2671: I think removing the line would fix it. In that case it falls back to the default of DbDictionary, which is "DOUBLE" and should be fine. > Wrong type mapping for double in HSQLDB > --- > > Key: OPENJPA-2671 > URL: https://issues.apache.org/jira/browse/OPENJPA-2671 > Project: OpenJPA > Issue Type: Bug > Components: jdbc >Affects Versions: 2.4.1 >Reporter: Andreas Borg > > Currently, Java type {{double}} is mapped to {{NUMERIC}} for HSQLDB: > {code:title=HSQLDictionary.java, line 82|borderStyle=solid} >doubleTypeName = "NUMERIC"; > {code} > (see > https://fisheye6.atlassian.com/browse/~tag=2.4.1/openjpa/tags/2.4.1/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/HSQLDictionary.java?hb=true). > This seems wrong to me, as HSQLDB's {{NUMERIC}} is not a binary floating > point type, but represents exact decimal numbers and maps to Java type > {{BigDecimal}} (see HSQL documentation: > http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types). The > corresponding HSQL type for {{double}} is, according to this manual, > {{REAL}}, {{FLOAT}} or {{DOUBLE}} (all being equivalent). -- This message was sent by Atlassian JIRA (v6.3.4#6332)