mirror of https://github.com/apache/openjpa.git
OPENJPA-241 Extra SQL on lazy CMR load
commit openjpa_241_1.patch on behalf of Fay Wang git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@679261 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37d610ca2c
commit
98802147f7
|
@ -347,15 +347,12 @@ public abstract class StoreCollectionFieldStrategy
|
|||
((Collection) coll).iterator().next();
|
||||
OpenJPAStateManager sm1 = (OpenJPAStateManager) pc.
|
||||
pcGetStateManager();
|
||||
FieldMapping[] fms = ((ClassMapping) sm1.getMetaData()).
|
||||
getDeclaredFieldMappings();
|
||||
for (int i = 0; i < fms.length; i++) {
|
||||
if (fms[i] == mappedByFieldMapping) {
|
||||
res.setMappedByValue(sm1.fetchObject(fms[i].
|
||||
getIndex()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ClassMapping clm = ((ClassMapping) sm1.getMetaData());
|
||||
FieldMapping fm = (FieldMapping) clm.getField(
|
||||
mappedByFieldMapping.getName());
|
||||
if (fm == mappedByFieldMapping)
|
||||
res.setMappedByValue(sm1.fetchObject(fm.getIndex()));
|
||||
} else {
|
||||
res.setMappedByValue(null);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue