mirror of https://github.com/apache/openjpa.git
OPENJPA-1387: Remove non-nullable constraint from Unique column.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@880834 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
93ae72d15f
commit
05c785704c
|
@ -46,6 +46,7 @@ import org.apache.openjpa.jdbc.schema.SchemaGroup;
|
|||
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 @@ public class MappingTool
|
|||
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 @@ public class MappingTool
|
|||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,6 +69,8 @@ public abstract class AbstractDB2Dictionary
|
|||
// the equivalent "X JOIN Y ON 1 = 1"
|
||||
crossJoinClause = "JOIN";
|
||||
requiresConditionForCrossJoin = true;
|
||||
|
||||
supportsNullUniqueConlumn = false;
|
||||
}
|
||||
|
||||
public void indexOf(SQLBuffer buf, FilterValue str, FilterValue find,
|
||||
|
|
|
@ -187,6 +187,7 @@ public class DBDictionary
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue