public int compareTo(Object obj) {
    if (obj == null) {
      return (-1);
    } else if (obj instanceof CFCrmAddressBuff) {
      CFCrmAddressBuff rhs = (CFCrmAddressBuff) obj;
      int retval = super.compareTo(rhs);
      if (retval != 0) {
        return (retval);
      }
      return (0);
    } else if (obj instanceof CFCrmAddressByTenantIdxKey) {
      CFCrmAddressByTenantIdxKey rhs = (CFCrmAddressByTenantIdxKey) obj;

      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFCrmAddressByContactIdxKey) {
      CFCrmAddressByContactIdxKey rhs = (CFCrmAddressByContactIdxKey) obj;

      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredContactId() < rhs.getRequiredContactId()) {
        return (-1);
      } else if (getRequiredContactId() > rhs.getRequiredContactId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFCrmAddressByUDescrIdxKey) {
      CFCrmAddressByUDescrIdxKey rhs = (CFCrmAddressByUDescrIdxKey) obj;

      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredContactId() < rhs.getRequiredContactId()) {
        return (-1);
      } else if (getRequiredContactId() > rhs.getRequiredContactId()) {
        return (1);
      }
      {
        int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFCrmAddressByCountryIdxKey) {
      CFCrmAddressByCountryIdxKey rhs = (CFCrmAddressByCountryIdxKey) obj;

      if (getOptionalCountryId() != null) {
        Short lhsCountryId = getOptionalCountryId();
        if (rhs.getOptionalCountryId() != null) {
          Short rhsCountryId = rhs.getOptionalCountryId();
          int cmp = lhsCountryId.compareTo(rhsCountryId);
          if (cmp != 0) {
            return (cmp);
          }
        } else {
          return (1);
        }
      } else {
        if (rhs.getOptionalCountryId() != null) {
          return (-1);
        }
      }
      return (0);
    } else if (obj instanceof CFCrmAddressHBuff) {
      CFCrmAddressHBuff rhs = (CFCrmAddressHBuff) obj;

      int retval = 0;
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredAddressId() < rhs.getRequiredAddressId()) {
        return (-1);
      } else if (getRequiredAddressId() > rhs.getRequiredAddressId()) {
        return (1);
      }
      if (getRequiredContactId() < rhs.getRequiredContactId()) {
        return (-1);
      } else if (getRequiredContactId() > rhs.getRequiredContactId()) {
        return (1);
      }
      {
        int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription());
        if (cmp != 0) {
          return (cmp);
        }
      }
      if (getOptionalAddrLine1() != null) {
        if (rhs.getOptionalAddrLine1() != null) {
          int cmp = getOptionalAddrLine1().compareTo(rhs.getOptionalAddrLine1());
          if (cmp != 0) {
            return (cmp);
          }
        } else {
          return (1);
        }
      } else {
        if (rhs.getOptionalAddrLine1() != null) {
          return (-1);
        }
      }
      if (getOptionalAddrLine2() != null) {
        if (rhs.getOptionalAddrLine2() != null) {
          int cmp = getOptionalAddrLine2().compareTo(rhs.getOptionalAddrLine2());
          if (cmp != 0) {
            return (cmp);
          }
        } else {
          return (1);
        }
      } else {
        if (rhs.getOptionalAddrLine2() != null) {
          return (-1);
        }
      }
      if (getOptionalCity() != null) {
        if (rhs.getOptionalCity() != null) {
          int cmp = getOptionalCity().compareTo(rhs.getOptionalCity());
          if (cmp != 0) {
            return (cmp);
          }
        } else {
          return (1);
        }
      } else {
        if (rhs.getOptionalCity() != null) {
          return (-1);
        }
      }
      if (getOptionalState() != null) {
        if (rhs.getOptionalState() != null) {
          int cmp = getOptionalState().compareTo(rhs.getOptionalState());
          if (cmp != 0) {
            return (cmp);
          }
        } else {
          return (1);
        }
      } else {
        if (rhs.getOptionalState() != null) {
          return (-1);
        }
      }
      if (getOptionalCountryId() != null) {
        Short lhsCountryId = getOptionalCountryId();
        if (rhs.getOptionalCountryId() != null) {
          Short rhsCountryId = rhs.getOptionalCountryId();
          int cmp = lhsCountryId.compareTo(rhsCountryId);
          if (cmp != 0) {
            return (cmp);
          }
        } else {
          return (1);
        }
      } else {
        if (rhs.getOptionalCountryId() != null) {
          return (-1);
        }
      }
      if (getOptionalZip() != null) {
        if (rhs.getOptionalZip() != null) {
          int cmp = getOptionalZip().compareTo(rhs.getOptionalZip());
          if (cmp != 0) {
            return (cmp);
          }
        } else {
          return (1);
        }
      } else {
        if (rhs.getOptionalZip() != null) {
          return (-1);
        }
      }
      return (0);
    } else if (obj instanceof CFCrmAddressHPKey) {
      CFCrmAddressHPKey rhs = (CFCrmAddressHPKey) obj;
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredAddressId() < rhs.getRequiredAddressId()) {
        return (-1);
      } else if (getRequiredAddressId() > rhs.getRequiredAddressId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFCrmAddressPKey) {
      CFCrmAddressPKey rhs = (CFCrmAddressPKey) obj;
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredAddressId() < rhs.getRequiredAddressId()) {
        return (-1);
      } else if (getRequiredAddressId() > rhs.getRequiredAddressId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFCrmHPKey) {
      CFCrmHPKey rhs = (CFCrmHPKey) obj;
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      return (0);
    } else {
      return (super.compareTo(obj));
    }
  }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFCrmAddressHBuff) {
     CFCrmAddressHBuff rhs = (CFCrmAddressHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     if (getOptionalAddrLine1() != null) {
       if (rhs.getOptionalAddrLine1() != null) {
         if (!getOptionalAddrLine1().equals(rhs.getOptionalAddrLine1())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine1() != null) {
         return (false);
       }
     }
     if (getOptionalAddrLine2() != null) {
       if (rhs.getOptionalAddrLine2() != null) {
         if (!getOptionalAddrLine2().equals(rhs.getOptionalAddrLine2())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine2() != null) {
         return (false);
       }
     }
     if (getOptionalCity() != null) {
       if (rhs.getOptionalCity() != null) {
         if (!getOptionalCity().equals(rhs.getOptionalCity())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCity() != null) {
         return (false);
       }
     }
     if (getOptionalState() != null) {
       if (rhs.getOptionalState() != null) {
         if (!getOptionalState().equals(rhs.getOptionalState())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalState() != null) {
         return (false);
       }
     }
     if (getOptionalCountryId() != null) {
       if (rhs.getOptionalCountryId() != null) {
         if (!getOptionalCountryId().equals(rhs.getOptionalCountryId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCountryId() != null) {
         return (false);
       }
     }
     if (getOptionalZip() != null) {
       if (rhs.getOptionalZip() != null) {
         if (!getOptionalZip().equals(rhs.getOptionalZip())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalZip() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressBuff) {
     CFCrmAddressBuff rhs = (CFCrmAddressBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     if (getOptionalAddrLine1() != null) {
       if (rhs.getOptionalAddrLine1() != null) {
         if (!getOptionalAddrLine1().equals(rhs.getOptionalAddrLine1())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine1() != null) {
         return (false);
       }
     }
     if (getOptionalAddrLine2() != null) {
       if (rhs.getOptionalAddrLine2() != null) {
         if (!getOptionalAddrLine2().equals(rhs.getOptionalAddrLine2())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalAddrLine2() != null) {
         return (false);
       }
     }
     if (getOptionalCity() != null) {
       if (rhs.getOptionalCity() != null) {
         if (!getOptionalCity().equals(rhs.getOptionalCity())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCity() != null) {
         return (false);
       }
     }
     if (getOptionalState() != null) {
       if (rhs.getOptionalState() != null) {
         if (!getOptionalState().equals(rhs.getOptionalState())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalState() != null) {
         return (false);
       }
     }
     if (getOptionalCountryId() != null) {
       if (rhs.getOptionalCountryId() != null) {
         if (!getOptionalCountryId().equals(rhs.getOptionalCountryId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCountryId() != null) {
         return (false);
       }
     }
     if (getOptionalZip() != null) {
       if (rhs.getOptionalZip() != null) {
         if (!getOptionalZip().equals(rhs.getOptionalZip())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalZip() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByTenantIdxKey) {
     CFCrmAddressByTenantIdxKey rhs = (CFCrmAddressByTenantIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByContactIdxKey) {
     CFCrmAddressByContactIdxKey rhs = (CFCrmAddressByContactIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByUDescrIdxKey) {
     CFCrmAddressByUDescrIdxKey rhs = (CFCrmAddressByUDescrIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredContactId() != rhs.getRequiredContactId()) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmAddressByCountryIdxKey) {
     CFCrmAddressByCountryIdxKey rhs = (CFCrmAddressByCountryIdxKey) obj;
     if (getOptionalCountryId() != null) {
       if (rhs.getOptionalCountryId() != null) {
         if (!getOptionalCountryId().equals(rhs.getOptionalCountryId())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalCountryId() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressHPKey) {
     CFCrmAddressHPKey rhs = (CFCrmAddressHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFCrmHPKey) {
     CFCrmHPKey rhs = (CFCrmHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFCrmAddressPKey) {
     CFCrmAddressPKey rhs = (CFCrmAddressPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredAddressId() != rhs.getRequiredAddressId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }