Object srcObject = record.getCurrentObject();
// the order in which the primary keys are added to the vector is
// relevant for cache lookup - it must match the ordering of the
// reference descriptor's primary key entries
Reference reference = resolver.getReference(this, srcObject);
CacheId primaryKeys;
if(null == referenceClass || ClassConstants.OBJECT == referenceClass) {
if (reference == null) {
// if reference is null, create a new instance and set it on the resolver
primaryKeys = new CacheId(new Object[1]);
reference = new Reference(this, srcObject, referenceClass, primaryKeys);
resolver.addReference(reference);
record.reference(reference);
} else {
primaryKeys = (CacheId) reference.getPrimaryKey();
}
primaryKeys.set(0, object);
} else {
Vector pkFieldNames = referenceDescriptor.getPrimaryKeyFieldNames();
// if reference is null, create a new instance and set it on the resolver
if (reference == null) {
primaryKeys = new CacheId(new Object[pkFieldNames.size()]);
reference = new Reference(this, srcObject, referenceClass, primaryKeys);
resolver.addReference(reference);
record.reference(reference);
} else {
primaryKeys = (CacheId) reference.getPrimaryKey();
}
XMLField tgtFld = (XMLField) getSourceToTargetKeyFieldAssociations().get(xmlField);
int idx = pkFieldNames.indexOf(tgtFld.getXPath());
// fix for bug# 5687430
// need to get the actual type of the target (i.e. int, String, etc.)