OPENJPA-1397: Allow some columns of compound key to be null.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@888417 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Pinaki Poddar 2009-12-08 14:51:44 +00:00
parent 3f3d586c73
commit 8607e0b3b4
1 changed files with 5 additions and 2 deletions

View File

@ -172,6 +172,7 @@ public class ClassMapping
Joinable join;
int pkIdx;
boolean canReadDiscriminator = true;
boolean isNullPK = true;
for (int i = 0; i < pks.length; i++) {
// we know that all pk column join mappings use primary key fields,
// cause this mapping uses the oid as its primary key (we recursed
@ -186,10 +187,12 @@ public class ClassMapping
vals[pkIdx] = join.getPrimaryKeyValue(res, join.getColumns(),
fk, store, joins);
res.endDataRequest();
if (vals[pkIdx] == null)
return null;
isNullPK = isNullPK && vals[pkIdx] == null;
}
}
if (isNullPK) {
return null;
}
// the oid data is loaded by the base type, but if discriminator data
// is present, make sure to use it to construct the actual oid instance