/**
   * Accessor for the primary key for this table. Overrides the method in TableImpl to add on any
   * specification of PK name in the <join> metadata.
   *
   * @return The primary key.
   */
  public PrimaryKey getPrimaryKey() {
    PrimaryKey pk = super.getPrimaryKey();
    if (mmd.getJoinMetaData() != null) {
      PrimaryKeyMetaData pkmd = mmd.getJoinMetaData().getPrimaryKeyMetaData();
      if (pkmd != null && pkmd.getName() != null) {
        pk.setName(pkmd.getName());
      }
    }

    return pk;
  }