field1.setJoinForeignKey(join);
field1.setJoinOuter(outer);
addJoinConstraints(field1);
field1.setForeignKey(fk);
addConstraints(field1);
field1.setStrategy(new RelationFieldStrategy(), null);
if (_custom != null)
_custom.customize(field1);
}
if (!_inverse || join != null)
return;
// create inverse relation
boolean unq = isUnique(fk);
name = getRelationName(cls.getDescribedType(), !unq, fk, true, rel);
Class type = (unq) ? cls.getDescribedType() : Set.class;
FieldMapping field2 = newFieldMapping(name, type, null, fk, rel);
if (field2 == null)
return;
if (field1 != null)
field2.setMappedBy(field1.getName());
if (unq) {
field2.setForeignKey(fk);
field2.setJoinDirection(field2.JOIN_INVERSE);
field2.setStrategy(new RelationFieldStrategy(), null);
} else {
ValueMapping vm = field2.getElementMapping();
vm.setDeclaredType(cls.getDescribedType());
vm.setForeignKey(fk);
vm.setJoinDirection(vm.JOIN_EXPECTED_INVERSE);