ClassMapping owner = field.getDefiningMapping();
while (fk.getPrimaryKeyTable() != owner.getTable()) {
joins = owner.joinSuperclass(joins, false);
owner = owner.getJoinablePCSuperclassMapping();
if (owner == null)
throw new InternalException();
}
return joins.joinRelation(field.getName(), fk, elem,
vm.getSelectSubclasses(), true, true);
}