有没有任何方法可以在不写查询的情况下用轻量级事务实现更新?如何从casandra 实现示例
UPDATE cycling.cyclist_name
SET firstname = ‘Roxane’
WHERE id = 4647f6d3-7bd2-4085-8d6c-1229351b5498
IF firstname = ‘Roxxane’;
通过
CassandraOperations cops;
cops.update()
或
cops.batchOps()
InsertOptions适用于
InsertOptions
.builder()
.ifNotExists(true)
.build();
自2.2以来,他们有一个api来指定条件检查官方链接
public UpdateOptions.UpdateOptionsBuilder ifCondition(Filter condition)
Use light-weight transactions by applying IF condition. Replaces a previous ifCondition(Filter) and ifExists(boolean).
Parameters:
condition - the condition to apply for conditional updates, must not be null.
Returns:
this UpdateOptions.UpdateOptionsBuilder
Since:
2.2