diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java index 6bf715d08..d04037bf7 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java @@ -2908,12 +2908,20 @@ public class DBDictionary || !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 && CONS_NAME_BEFORE.equals(constraintNameMode))