/**
   * @return the attribute bindings for this EntityBinding and all of its sub-EntityBinding,
   *     starting from the root of the hierarchy; includes the identifier and attribute bindings
   *     defined as part of a join.
   */
  public AttributeBinding[] getEntitiesAttributeBindingClosure() {
    AttributeBinding[] results = getAttributeBindingClosure();

    for (EntityBinding subEntityBinding : getPreOrderSubEntityBindingClosure()) {
      // only add attribute bindings declared for the subEntityBinding

      results =
          ArrayHelper.join(
              results,
              subEntityBinding
                  .attributeBindingMapInternal()
                  .values()
                  .toArray(
                      new AttributeBinding[subEntityBinding.attributeBindingMapInternal().size()]));
      // TODO: if EntityBinding.attributeBindings() excludes joined attributes, then they need to be
      // added here
    }
    return results;
  }