public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFSecurityTenantByUNameIdxKey) {
     CFSecurityTenantByUNameIdxKey rhs = (CFSecurityTenantByUNameIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTenantBuff) {
     CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) {
       return (false);
     }
     return (true);
   } else {
     return (false);
   }
 }
 public int compareTo(Object obj) {
   if (obj == null) {
     return (1);
   } else if (obj instanceof CFSecurityTenantByUNameIdxKey) {
     CFSecurityTenantByUNameIdxKey rhs = (CFSecurityTenantByUNameIdxKey) obj;
     if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
       return (-1);
     } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
       return (1);
     }
     {
       int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName());
       if (cmp != 0) {
         return (cmp);
       }
     }
     return (0);
   } else if (obj instanceof CFSecurityTenantBuff) {
     CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) obj;
     if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
       return (-1);
     } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
       return (1);
     }
     {
       int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName());
       if (cmp != 0) {
         return (cmp);
       }
     }
     return (0);
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null);
   }
 }
 public void updateTenant(CFSecurityAuthorization Authorization, CFSecurityTenantBuff Buff) {
   final String S_ProcName = "updateTenant";
   ResultSet resultSet = null;
   try {
     long ClusterId = Buff.getRequiredClusterId();
     long Id = Buff.getRequiredId();
     String TenantName = Buff.getRequiredTenantName();
     int Revision = Buff.getRequiredRevision();
     Connection cnx = schema.getCnx();
     String sql =
         "exec sp_update_tenant ?, ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + ", "
             + "?"
             + ", "
             + "?";
     if (stmtUpdateByPKey == null) {
       stmtUpdateByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtUpdateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtUpdateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtUpdateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtUpdateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtUpdateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtUpdateByPKey.setString(argIdx++, "TENT");
     stmtUpdateByPKey.setLong(argIdx++, ClusterId);
     stmtUpdateByPKey.setLong(argIdx++, Id);
     stmtUpdateByPKey.setString(argIdx++, TenantName);
     stmtUpdateByPKey.setInt(argIdx++, Revision);
     resultSet = stmtUpdateByPKey.executeQuery();
     if (resultSet.next()) {
       CFSecurityTenantBuff updatedBuff = unpackTenantResultSetToBuff(resultSet);
       if (resultSet.next()) {
         resultSet.last();
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(
                 getClass(),
                 S_ProcName,
                 "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
       }
       Buff.setRequiredClusterId(updatedBuff.getRequiredClusterId());
       Buff.setRequiredTenantName(updatedBuff.getRequiredTenantName());
       Buff.setRequiredRevision(updatedBuff.getRequiredRevision());
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(),
               S_ProcName,
               "Expected a single-record response, " + resultSet.getRow() + " rows selected");
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }