日期:2014-05-17  浏览次数:20805 次

Apache Cassandra Learning Step by Step (3): Samples ABC

====16 Feb 2012, by Bright Zheng (IT进行时)====

4.?Samples ABC

We try to learn it step by step to understand the concepts and Java API usages by means of:

1. Concept Introduction

2. CLI

3. Java Sample Code

4.1.?Get a Single Column by a Key

4.1.1.?Sample Code

public QueryResult<HColumn<String,String>> execute() {???????

??????? ColumnQuery<String, String, String> columnQuery = HFactory.createStringColumnQuery(keyspace);

??????? columnQuery.setColumnFamily("Npanxx");

??????? columnQuery.setKey("512204");

??????? columnQuery.setName("city");

??????? QueryResult<HColumn<String, String>> result = columnQuery.execute();

???????

??????? return result;

??? }


4.1.2.??Sample Code run by Maven

C:\projects_learning\learning-cassandra-tutorial>mvn -e e