Object fieldValue = relatedPKField.getPrimaryKeyValue(relatedId);
foreignKeyFields[i].setValueInternal(ctx, fieldValue, markDirty);
}
if (fkConstraint != null) {
PersistentContext pctx = (PersistentContext) ctx.getPersistenceContext();
if (relatedId == null) {
pctx.nullForeignKey(fkConstraint);
} else {
pctx.nonNullForeignKey(fkConstraint);
}
}
}