Spring Data Cassandra - 检索受影响的行
问题描述:
是否有可能获取Update Statement中受影响的行?Spring Data Cassandra - 检索受影响的行
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操作那样做。
答
正如我怀疑,鉴于卡桑德拉的分布式特性与一致性的不同程度,简单的答案是否定的。
其他有如此前张贴类似的问题,例如...