public int compareTo(SocialRelation socialRelation) {
    long pk = socialRelation.getPrimaryKey();

    if (getPrimaryKey() < pk) {
      return -1;
    } else if (getPrimaryKey() > pk) {
      return 1;
    } else {
      return 0;
    }
  }
  public boolean equals(Object obj) {
    if (obj == null) {
      return false;
    }

    SocialRelation socialRelation = null;

    try {
      socialRelation = (SocialRelation) obj;
    } catch (ClassCastException cce) {
      return false;
    }

    long pk = socialRelation.getPrimaryKey();

    if (getPrimaryKey() == pk) {
      return true;
    } else {
      return false;
    }
  }