Hello I m trying to obtain data from cassandra using hector. There are two ways of doing this.
a) 类似情况:
CqlQuery<String, String, Long> cqlQuery = new CqlQuery<String, String, Long>(connect.tutorialKeyspace, stringSerializer, stringSerializer, longSerializer);
cqlQuery.setQuery("select home from page_view_counts where KEY ="localhost");
QueryResult<CqlRows<String, String, Long>> result;
try
{
result = cqlQuery.execute();
}
catch(HectorException e){
result = null;
message = e.getMessage();
}
如果没有问询,它就应当如此,但我可以不问:
SliceQuery<String, String, Long> query = HFactory.createSliceQuery(connect.tutorialKeyspace, stringSerializer,stringSerializer,longSerializer);
QueryResult<ColumnSlice<String, Long>> result2 = query.setColumnFamily("page_view_counts").setKey("localhost").setColumnNames("home").execute();
我在什么地方犯错误?