Thursday, June 23, 2011

Retreiving a column from cassandra using hector api 0.7

RETRIEVE A SINGLE COLUMN
Retrieving a column from Cassandra is a straight forward operation. Using the ColumnQuery object to retrieve the information we inserted in the example above, we would have:
ColumnQuery columnQuery =
HFactory.createStringColumnQuery(keyspace);
columnQuery.setColumnFamily("Standard1").setKey("jsmith").setName("first");
Result<HColumn<String, String&rt;&rt; result = columnQuery.execute();
Note the strong typing provided by the ColumnQuery and Result objects.

No comments:

Post a Comment