// Set the field value and presence mask bit.
setFieldValue(sm, f, value);
}
} else {
ResultDesc frd = (ResultDesc) temp;
ForeignFieldDesc parentField = frd.parentField;
// Only try to fetch the field if it is not already present.
// If the field is already present, it should be in
// consistent state w.r.t. this transaction. Overwriting
// it with the value from database might corrupt consistency of data.
if (!sm.getPresenceMaskBit(parentField.absoluteID) || parentField.cardinalityUPB > 1) {
Object fobj = frd.setFields(pm, resultData);
if (parentField.cardinalityUPB > 1) { // parentField is a collection.
// Add the value and set the presence mask bit if necessary
addCollectionValue(sm, parentField, fobj);
} else { // parentField is an object.
// Set the field value and presence mask bit.
setFieldValue(sm, parentField, fobj);
}
}
if (debug) {
logger.finest("sqlstore.resultdesc.marking_foreign_field", // NOI18N
parentField.getName());
}
}
}
sm.initialize(true);