I don't think this correct, you want to make sure the parent isn't also a child, so this should be if (OrderUtil.isType(ot, orderType.getParent())) then fail