int idx = 0;
for (Iterator j = desc.getMappings().iterator(); j.hasNext();) {
DatabaseMapping dm = (DatabaseMapping) j.next();
String attributeName = dm.getAttributeName();
DatabaseMapping xdm = xdesc.getMappingForAttributeName(attributeName);
dm.setAttributeAccessor(new BaseEntityAccessor(attributeName, idx));
if (xdm != null) {
if (dm.isForeignReferenceMapping()) {
ForeignReferenceMapping frm = (ForeignReferenceMapping)dm;
if (frm.usesIndirection() && frm.getIndirectionPolicy().getClass().
isAssignableFrom(BasicIndirectionPolicy.class)) {
xdm.setAttributeAccessor(new BaseEntityVHAccessor(attributeName, idx));
} else {
// no indirection or indirection that is transparent enough (!) to work
xdm.setAttributeAccessor(new BaseEntityAccessor(attributeName, idx));
}
}
else {
xdm.setAttributeAccessor(new BaseEntityAccessor(attributeName, idx));
if (xdm.isDirectToFieldMapping()) {
XMLDirectMapping xmlDM = (XMLDirectMapping)xdm;
XMLField xmlField = (XMLField)xmlDM.getField();
Class clz = SCHEMA_2_CLASS.get(xmlField.getSchemaType());
if (clz != null) {