openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1398979 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractDB2Dictionary.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
Date Tue, 16 Oct 2012 20:30:32 GMT
Author: curtisr7
Date: Tue Oct 16 20:30:31 2012
New Revision: 1398979

URL: http://svn.apache.org/viewvc?rev=1398979&view=rev
Log:
OPENJPA-2280: Change AbstractDB2Dictionary numeric type mapping from DOUBLE to DECIMAL.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractDB2Dictionary.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractDB2Dictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractDB2Dictionary.java?rev=1398979&r1=1398978&r2=1398979&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractDB2Dictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractDB2Dictionary.java
Tue Oct 16 20:30:31 2012
@@ -29,7 +29,10 @@ public abstract class AbstractDB2Diction
     public int varcharCastLength = 1000;
 
     public AbstractDB2Dictionary() {
-        numericTypeName = "DOUBLE";
+    	// http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.apdv.java.doc
+    	//	/doc/rjvjdata.htm
+		// http://db.apache.org/derby/docs/10.3/ref/rrefsqlj12362.html
+    	numericTypeName = "DECIMAL";
         bitTypeName = "SMALLINT";
         smallintTypeName = "SMALLINT";
         tinyintTypeName = "SMALLINT";
@@ -69,6 +72,9 @@ public abstract class AbstractDB2Diction
         // the equivalent "X JOIN Y ON 1 = 1"
         crossJoinClause = "JOIN";
         requiresConditionForCrossJoin = true;
+        
+        // DB2 / Derby allows precision to be set on a DECIMAL column.
+        fixedSizeTypeNameSet.remove("DECIMAL");
     }
 
     public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find,

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java?rev=1398979&r1=1398978&r2=1398979&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/identity/TestSQLBigDecimalId.java
Tue Oct 16 20:30:31 2012
@@ -59,8 +59,6 @@ public class TestSQLBigDecimalId
         
     }
     
-    @AllowFailure
-    // This test currently allows failure because DB2 and Derby don't handle BigDecimals
properly quite yet. 
     public void testQuery() {
         int data = 156;
         BigDecimal decimal = new BigDecimal(1234);
@@ -77,6 +75,7 @@ public class TestSQLBigDecimalId
             (SQLBigDecimalIdEntity) em.createQuery("SELECT a FROM SQLBigDecimalIdEntity a
WHERE a.data=" + data)
                 .getSingleResult();
         
+        // This would fail prior to OPENJPA-1224.
         assertEquals(e, e2);
         em.close();
 



Mime
View raw message