public Vector createPkVectorFromKey(Object key, AbstractSession session) {
// If the descriptor primary key is mapped through direct-to-field mappings,
// then no elaborate conversion is required.
// If key is compound, add each value to the vector.
KeyElementAccessor[] pkElementArray = this.getKeyClassFields(key.getClass());
Vector pkVector = new NonSynchronizedVector(pkElementArray.length);
for (int index = 0; index < pkElementArray.length; index++) {
DatabaseMapping mapping = this.keyMappings[index];
Object fieldValue = null;
if (mapping.isDirectToFieldMapping()) {
fieldValue = ((AbstractDirectMapping)mapping).getFieldValue(pkElementArray[index].getValue(key), session);
} else {
fieldValue = pkElementArray[index].getValue(key);
}
pkVector.add(fieldValue);
}
return pkVector;
}