if ((pkElementArray.length == 1) && (pkElementArray[0] instanceof KeyIsElementAccessor)) {
DatabaseMapping mapping = getDescriptor().getObjectBuilder().getMappingForAttributeName(pkElementArray[0].getAttributeName());
if (mapping.isDirectToFieldMapping()) {
Converter converter = ((DirectToFieldMapping) mapping).getConverter();
if (converter != null){
return converter.convertDataValueToObjectValue(keyElements[elementIndex[0]], session);
}
keyInstance = keyElements[elementIndex[0]];
} else if (mapping.isObjectReferenceMapping()) { // what if mapping comes from derived ID. need to get the derived mapping.
//get reference descriptor and extract pk from target cmp policy
keyInstance = mapping.getReferenceDescriptor().getCMPPolicy().createPrimaryKeyInstanceFromPrimaryKeyValues(session, elementIndex, keyElements);