title: Retrieve multiple columns value from Cassandra using Hector client
body: <p>I am working with Cassandra and I am using Hector client to read and upsert the data in Cassandra database. I am trying to retrieve the data from Cassandra database using hector client and I am able to do that if I am trying to retrieve only one column.</p>
  
  <p>Now I am trying to retrieve the data for <code>rowKey as 1011</code> but with columnNames as collection of string. Below is my API that will retrieve the data from Cassandra database using Hector client-</p>
  
  <pre><code>public Map&lt;String, String&gt; getAttributes(String rowKey, Collection&lt;String&gt; attributeNames, String columnFamily) {
  
      final Cluster cluster = CassandraHectorConnection.getInstance().getCluster();       
      final Keyspace keyspace = CassandraHectorConnection.getInstance().getKeyspace();
  
      try {
  
          ColumnQuery&lt;String, String, String&gt; columnQuery = HFactory
                  .createStringColumnQuery(keyspace)
                  .setColumnFamily(columnFamily).setKey(rowKey)
                  .setName("c1");
  
          QueryResult&lt;HColumn&lt;String, String&gt;&gt; result = columnQuery.execute();
          System.out.println("Column Name from cassandra: " + result.get().getName() + "Column value from cassandra: " + result.get().getValue());
  
      } catch (HectorException e) {
          LOG.error("Exception in CassandraHectorClient::getAttributes " +e+ ", RowKey = " +rowKey+ ", Attribute Names = " +attributeNames);
      } finally {
          cluster.getConnectionManager().shutdown();
      }
  
  
      return null;
  
  }
  </code></pre>
  
  <p>If you see my above method, I am trying to retrieve the data from Cassandra database for a particular <code>rowKey</code> and for <code>column c1</code>. Now I am trying to retrieve the data from Cassandra database for collection of columns for a particular rowKey.</p>
  
  <p>Meaning something like this-</p>
  
  <p>I want to retrieve the data for multiple columns but for the same rowKey. How can I do this using Hector client? And I don't want to retrieve the data for all the columns and then iterate to find out the individual columns data I am looking for.</p>