public void writeFromObjectIntoRow(Object object, AbstractRecord row, AbstractSession session, WriteType writeType) throws DescriptorException {
Object value = getAttributeValueFromObject(object);
Class valueClass = value.getClass();
if(valueClass == XMLRoot.class) {
//look for a nested mapping based on the Root's QName
XMLRoot root = (XMLRoot)value;
for(DatabaseField next:this.fields) {
XMLField xmlField = (XMLField)next;
XPathFragment fragment = xmlField.getXPathFragment();
while(fragment != null && !fragment.nameIsText()) {
if(fragment.getNextFragment() == null || fragment.getHasText()) {
if(fragment.getLocalName().equals(root.getLocalName())) {
String fragUri = fragment.getNamespaceURI();
String namespaceUri = root.getNamespaceURI();
if((namespaceUri == null && fragUri == null) || (namespaceUri != null && fragUri != null && namespaceUri.equals(fragUri))) {
XMLMapping mapping = choiceElementMappings.get(xmlField);
mapping.writeSingleValue(value, object, (XMLRecord)row, session);
return;
}
}
}
fragment = fragment.getNextFragment();
}
}
//If the root doesn't match any of the types, try the class
valueClass = root.getObject().getClass();
}
XMLField valueField = this.classToFieldMappings.get(valueClass);
if (valueField == null) {
List<XMLField> xflds = getClassToSourceFieldsMappings().get(valueClass);
if (xflds != null) {