if (row == null) {
return selfReference;
}
if (foreignKey.getReferencedTable() == foreignKey.getReferencingTable()) {
selfReference = true;
RowDataValueSource parent = new RowDataValueSource();
RowDataValueSource child = new RowDataValueSource();
for (JoinColumn join : foreignKey.getJoinColumns()) {
parent.bind(join.getParent().getFieldDef(), row);
child.bind(join.getChild().getFieldDef(), row);
TInstance pInst = parent.getType();
TInstance cInst = child.getType();
TKeyComparable comparable = typesRegistryService.getKeyComparable(pInst.typeClass(), cInst.typeClass());
int c = (comparable != null) ?
comparable.getComparison().compare(pInst, parent, cInst, child) :
TClass.compare(pInst, parent, cInst, child);
selfReference &= (c == 0);