0

是否有可能在更新语句中获得受影响的行?

public void removeCountry(String id,int version) throws VersionException {
    log.debug("Update row"+id);
    try {
        Update update = QueryBuilder.update("country");
        update.setConsistencyLevel(ConsistencyLevel.ONE);
        update.with(QueryBuilder.set("destroyed", true));
        update.where(QueryBuilder.eq("id",id));
        update.where(QueryBuilder.eq("version",version));
        cassandraOperations.execute(update);
        //How to I know if the row was updated
        int rows = 0;//complete
        if (rows==0) throw new VersionException("Row does not been updated yet);
    } catch (Exception e) {
        log.error(e.getMessage(),e);
    }
}

我是 Cassandra 的新手,所以我不知道我是否可以像 JDBC 操作那样做到这一点。

4

1 回答 1

1

正如我所怀疑的,鉴于 Cassandra 的分布式特性具有不同程度的一致性,简短的回答是否定的。

其他人之前在 SO 上发布过类似的问题,例如...

如何知道 Cassandra(CQL) 中受影响的行?

于 2016-06-14T19:58:03.973 回答