if (Relation.BELONGS_TO_TYPE.equals(relationType)) {
//Note: In this case, owner is child and target is parent.
if (newTarget == null) {
if (owner.isPKDependentOf(classB)) {
throw new InvalidOperationException("Cannot nullify a primary key field.");
}
//decrement counter of old parent if there is one when the reverse relation is has-many.
if (!owner.isNewRecord() && Relation.HAS_MANY_TYPE.equals(reverseRelationType) && !isEmpty()) {
owner.decrementCounterInParent((BelongsToRelation)recordRelation.getRelation());