openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mprud...@apache.org
Subject svn commit: r449532 - /incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Date Mon, 25 Sep 2006 00:19:36 GMT
Author: mprudhom
Date: Sun Sep 24 17:19:36 2006
New Revision: 449532

URL: http://svn.apache.org/viewvc?view=rev&rev=449532
Log:
Override "ON DELETE SET NULL" foreign keys if the foreign column is "NOT NULL".

Modified:
    incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java

Modified: incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
URL: http://svn.apache.org/viewvc/incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java?view=diff&rev=449532&r1=449531&r2=449532
==============================================================================
--- incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
(original)
+++ incubator/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java
Sun Sep 24 17:19:36 2006
@@ -2908,11 +2908,19 @@
             || !supportsUpdateAction(fk.getUpdateAction()))
             return null;
 
-        String delAction = getActionName(fk.getDeleteAction());
-        String upAction = getActionName(fk.getUpdateAction());
-
         Column[] locals = fk.getColumns();
         Column[] foreigns = fk.getPrimaryKeyColumns();
+
+        int delActionId = fk.getDeleteAction();
+        if (delActionId == ForeignKey.ACTION_NULL) {
+            for (int i = 0; i < foreigns.length; i++) {
+                if (foreigns[i].isNotNull())
+                    delActionId = ForeignKey.ACTION_NONE;
+            }
+        }
+
+        String delAction = getActionName(delActionId);
+        String upAction = getActionName(fk.getUpdateAction());
 
         StringBuffer buf = new StringBuffer();
         if (fk.getName() != null



Mime
View raw message