Cassandra does not update data using CQL using mutator

In the following code, I am trying to update a line

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

Updating the CQL query is not performed, the update is performed using the mutator. Where is the mistake?

+3
source share
1 answer

It looks like your key and column name is transposed. For the keys, you have: "fahrer2" in the mutator and "first" in the CQL query.

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

+3
source

All Articles