List<XMLField> sourceFields = classToSourceFieldsMappings.get(value.getClass());
if(sourceFields != null && sourceFields.size() > 0) {
DatabaseMapping xmlMapping = (DatabaseMapping)this.choiceElementMappings.get(sourceFields.get(0));
for(XMLField next:sourceFields) {
fieldValue = ((XMLCollectionReferenceMapping)xmlMapping).buildFieldValue(value, next, session);
XMLEntry entry = new XMLEntry();
entry.setValue(fieldValue);
entry.setXMLField(next);
nestedRows.add(entry);
}
}
} else {
DatabaseMapping xmlMapping = (DatabaseMapping)this.choiceElementMappings.get(associatedField);
if(xmlMapping.isAbstractCompositeCollectionMapping()) {
fieldValue = ((XMLCompositeCollectionMapping)xmlMapping).buildCompositeRow(fieldValue, session, row, writeType);
}
XMLEntry entry = new XMLEntry();
entry.setValue(fieldValue);
entry.setXMLField(associatedField);
nestedRows.add(entry);
}
}
((DOMRecord)row).put(getFields(), nestedRows);
}