if ((pk == null) || (pk instanceof CacheId) && (((CacheId)pk).getPrimaryKey().length == 0)) {
pk = new CacheId(new Object[]{ new WeakObjectWrapper(object) });
}
CacheKey cacheKey = session.getIdentityMapAccessorInstance().getCacheKeyForObject(pk, getDescriptor().getJavaClass(), getDescriptor(), false);
if ((cacheKey != null) && (cacheKey.getRecord() != null)) {
XMLRecord nestedRecord = (XMLRecord)cacheKey.getRecord();
nestedRecord.setMarshaller(parentRecord.getMarshaller());
nestedRecord.setLeafElementType(parentRecord.getLeafElementType());
parentRecord.setLeafElementType(null);
return buildIntoNestedRow(nestedRecord, object, session);
}
}
Element newNode = XPathEngine.getInstance().createUnownedElement(parentRecord.getDOM(), (XMLField)xmlField);
XMLRecord nestedRecord = new DOMRecord(newNode);
nestedRecord.setNamespaceResolver(parentRecord.getNamespaceResolver());
nestedRecord.setMarshaller(parentRecord.getMarshaller());
nestedRecord.setLeafElementType(parentRecord.getLeafElementType());
parentRecord.setLeafElementType(null);
return buildIntoNestedRow(nestedRecord, object, session);
}