DATACASS-466 - Align insert(…) and update(…) return types to their possible outcomes.
We now return WriteResult for insert(…) and update(…) methods accepting WriteOptions. Conditional writes return a state whether the operation was applied or not and this result is propagated via WriteResult to the caller. Synchronous insert(…) and update(…) without WriteOptions methods do not return a value and are consistent with other Template API modules. The absence of an Exception indicates success. Asynchronous and reactive insert(…) and update(…) without WriteOptions continue to return the entity to make the entity accessible after operation completion. Previously, we returned null if a lightweight transaction was not applied or suppressed the value value emission.
This commit is contained in:
@@ -1159,13 +1159,13 @@ Person qp = cassandraTemplate.selectOne(query(where("age").is(33)), Person.class
|
||||
|
||||
The insert/save operations available to you are listed below.
|
||||
|
||||
* `T` *insert* `(T objectToSave)` Insert the object in an Apache Cassandra table.
|
||||
* `T` *insert* `(T objectToSave, InsertOptions options)` Insert the object in an Apache Cassandra table applying `InsertOptions`.
|
||||
* `void` *insert* `(Object objectToSave)` Insert the object in an Apache Cassandra table.
|
||||
* `WriteResult` *insert* `(Object objectToSave, InsertOptions options)` Insert the object in an Apache Cassandra table applying `InsertOptions`.
|
||||
|
||||
A similar set of update operations is listed below
|
||||
|
||||
* `T` *update* `(T objectToSave)` Update the object in an Apache Cassandra table.
|
||||
* `T` *update* `(T objectToSave, UpdateOptions options)` Update the object in an Apache Cassandra table applying `UpdateOptions`.
|
||||
* `void` *update* `(Object objectToSave)` Update the object in an Apache Cassandra table.
|
||||
* `WriteResult` *update* `(Object objectToSave, UpdateOptions options)` Update the object in an Apache Cassandra table applying `UpdateOptions`.
|
||||
|
||||
Then, there is always the old fashioned way. You can write your own CQL statements. You can configure with `InsertOptions` and `UpdateOptions`
|
||||
additional options such as TTL, consistency level and lightweight transactions.
|
||||
|
||||
Reference in New Issue
Block a user