openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r880834 - in /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc: meta/MappingTool.java sql/AbstractDB2Dictionary.java sql/DBDictionary.java
Date Mon, 16 Nov 2009 16:29:18 GMT
Author: ppoddar
Date: Mon Nov 16 16:29:18 2009
New Revision: 880834

URL: http://svn.apache.org/viewvc?rev=880834&view=rev
Log:
OPENJPA-1387: Remove non-nullable constraint from Unique column.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/AbstractDB2Dictionary.java
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java?rev=880834&r1=880833&r2=880834&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/MappingTool.java
Mon Nov 16 16:29:18 2009
@@ -46,6 +46,7 @@
 import org.apache.openjpa.jdbc.schema.SchemaSerializer;
 import org.apache.openjpa.jdbc.schema.SchemaTool;
 import org.apache.openjpa.jdbc.schema.Table;
+import org.apache.openjpa.jdbc.schema.Unique;
 import org.apache.openjpa.jdbc.schema.XMLSchemaSerializer;
 import org.apache.openjpa.jdbc.sql.DBDictionary;
 import org.apache.openjpa.kernel.Seq;
@@ -753,6 +754,7 @@
         Schema[] schemas = _schema.getSchemas();
         Table[] tables;
         Column[] cols;
+        Unique[] unqs;
         for (int i = 0; i < schemas.length; i++) {
             tables = schemas[i].getTables();
             for (int j = 0; j < tables.length; j++) {
@@ -761,8 +763,17 @@
 
                 tables[j].getPrimaryKey().setLogical(false);
                 cols = tables[j].getPrimaryKey().getColumns();
-                for (int k = 0; k < cols.length; k++)
+                for (int k = 0; k < cols.length; k++) {
                     cols[k].setNotNull(true);
+                }
+                unqs = tables[j].getUniques();
+                if (!_dict.supportsNullUniqueConlumn) {
+                    for (Unique u : unqs) {
+                        for (Column c : u.getColumns()) {
+                            c.setNotNull(true);
+                        }
+                    }
+                }
             }
         }
     }

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=880834&r1=880833&r2=880834&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
Mon Nov 16 16:29:18 2009
@@ -69,6 +69,8 @@
         // the equivalent "X JOIN Y ON 1 = 1"
         crossJoinClause = "JOIN";
         requiresConditionForCrossJoin = true;
+        
+        supportsNullUniqueConlumn = false;
     }
 
     public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find,

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?rev=880834&r1=880833&r2=880834&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Mon Nov 16 16:29:18 2009
@@ -187,6 +187,7 @@
     public boolean supportsRestrictDeleteAction = true;
     public boolean supportsCascadeDeleteAction = true;
     public boolean supportsNullDeleteAction = true;
+    public boolean supportsNullUniqueConlumn = true;
     public boolean supportsDefaultDeleteAction = true;
     public boolean supportsRestrictUpdateAction = true;
     public boolean supportsCascadeUpdateAction = true;



Mime
View raw message