OPENJPA-1387: Remove non-nullable constraint from Unique column.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@880865 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-11-16 17:32:21 +00:00
parent 05c785704c
commit 69d2415b57
2 changed files with 6 additions and 2 deletions

View File

@ -260,7 +260,7 @@ public class TableJDBCSeq
// importTable() does not import unique constraints
Unique[] uniques = _pkColumn.getTable().getUniques();
for (Unique u : uniques) {
copy.importUnique(u);
copy.importUnique(u, _conf.getDBDictionaryInstance());
}
// we need to reset the table name in the column with the
// fully qualified name for matching the table name from the

View File

@ -737,7 +737,7 @@ public class Table
/**
* Import a constraint; column names must match columns of this table.
*/
public Unique importUnique(Unique unq) {
public Unique importUnique(Unique unq, DBDictionary dict) {
if (unq == null)
return null;
@ -747,6 +747,10 @@ public class Table
Column[] cols = unq.getColumns();
for (int i = 0; i < cols.length; i++)
copy.addColumn(getColumn(cols[i].getName()));
if (dict != null && !dict.supportsNullUniqueConlumn) {
for (Column col : copy.getColumns())
col.setNotNull(true);
}
return copy;
}