2011-06-18 51 views
3

用下面的代碼我嘗試更新行卡桑德拉不與CQL更新數據,與突變它

Keyspace fKeyspace = HFactory.createKeyspace(KEYSPACE, fCluster); 

// Update with CQL 
CqlQuery<String,String,String> cqlQuery = 
    new CqlQuery<String,String,String>(fKeyspace, fStringS, fStringS, fStringS); 
cqlQuery.setQuery(
    "INSERT INTO Fahrer (KEY, 'first') VALUES('fahrer1', 'FirstnameUpdated')"); 
QueryResult<CqlRows<String,String,String>> result = cqlQuery.execute(); 

// Update with mutator 
Mutator<String> mutator = HFactory.createMutator(fKeyspace, fStringS); 
MutationResult mr = mutator.insert("fahrer2", "Fahrer", 
    HFactory.createStringColumn("first", "SecondUpdated")); 

不執行CQL查詢的更新,執行與突變更新。錯誤在哪裏?

回答

3

您似乎將您的密鑰和列名稱轉置。對於您在密鑰中具有的密鑰: 「fahrer2」和CQL查詢上的「第一個」。

如果您還沒有,請參見更多定製列表中赫以下(和一般): https://github.com/rantav/hector/wiki/Using-CQL

+0

謝謝你的提示!我使用兩個不同的鍵來測試兩個不同的行......否則,增詞器將「隱藏」CQL字符串的變化。兩行都有「第一個」列。我已經閱讀了整個Hector wiki,但仍然存在問題......並且有一個JavaDoc-API可用是很好的^^ – strauberry