mirror of https://github.com/apache/openjpa.git
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:
parent
3f3d586c73
commit
8607e0b3b4
openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue