// put the byAndFields (if not null) into the hash map first,
// they will be overridden by value's fields if over-specified this is important for security and cleanliness
Map<String, Object> fields = FastMap.newInstance();
if (byAndFields != null) fields.putAll(byAndFields);
for (int i = 0; i < relation.getKeyMapsSize(); i++) {
ModelKeyMap keyMap = relation.getKeyMap(i);
fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName()));
}
GenericPK dummyPK = GenericPK.create(relatedEntity, fields);
dummyPK.setDelegator(this);
return dummyPK;