Override "ON DELETE SET NULL" foreign keys if the foreign column is "NOT NULL".

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@449532 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Marc Prud'hommeaux 2006-09-25 00:19:36 +00:00
parent a8c1fad16c
commit d3956a7d98
1 changed files with 11 additions and 3 deletions

View File

@ -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))