开发者

Cassandra is not updating data with CQL, with mutator it does

开发者 https://www.devze.com 2023-03-14 06:32 出处:网络
With the following code I try to update a row Keyspace fKeyspace = HFactory.createKeyspace(KEYSPACE, fCluster);

With the following code I try to update a row

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"));

The update of the CQL-query is not performed, the update with the mutator is performed. Where is the mistake?


You appear to have your key and column name transposed. For keys you have: "fahrer2" on the mutator and "first" on the CQL query.

If you have not already, please see the following for more on CQL in Hector (and in general): https://github.com/rantav/hector/wiki/Using-CQL

0

精彩评论

暂无评论...
验证码 换一张
取 消