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:
Catalina Wei 2008-07-24 01:36:44 +00:00
parent 37d610ca2c
commit 98802147f7
1 changed files with 6 additions and 9 deletions

View File

@ -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);
}