/** INTERNAL: Process the primary key join columms for this accessors annotated element. */
  protected List<PrimaryKeyJoinColumnMetadata> processPrimaryKeyJoinColumns(
      PrimaryKeyJoinColumnsMetadata primaryKeyJoinColumns) {
    // If the primary key join columns were not specified (that is empty),
    // this call will add any defaulted columns as necessary.
    List<PrimaryKeyJoinColumnMetadata> pkJoinColumns = primaryKeyJoinColumns.values(m_descriptor);

    if (m_descriptor.hasCompositePrimaryKey()) {
      // Validate the number of primary key fields defined.
      if (pkJoinColumns.size() != m_descriptor.getPrimaryKeyFields().size()) {
        throw ValidationException.incompletePrimaryKeyJoinColumnsSpecified(getAnnotatedElement());
      }

      // All the primary and foreign key field names should be specified.
      for (PrimaryKeyJoinColumnMetadata pkJoinColumn : pkJoinColumns) {
        if (pkJoinColumn.isPrimaryKeyFieldNotSpecified()
            || pkJoinColumn.isForeignKeyFieldNotSpecified()) {
          throw ValidationException.incompletePrimaryKeyJoinColumnsSpecified(getAnnotatedElement());
        }
      }
    } else {
      if (pkJoinColumns.size() > 1) {
        throw ValidationException.excessivePrimaryKeyJoinColumnsSpecified(getAnnotatedElement());
      }
    }

    return pkJoinColumns;
  }