DATACASS-454 - Extend @Query to declare idempotent CQL queries.

String-based queries can now be marked as idempotent. Also, SELECT queries defined via @Query are also considered idempotent to make these retryable.

interface PersonRepository extends Repository<Person, String> {

    @Query("SELECT * FROM person WHERE lastname = ?0;") // idempotent by default
    Person findByLastname(String lastname);

    @Query(value = "UPDATE person SET lastname = ?0", idempotent = Query.Idempotency.IDEMPOTENT)
    void updatePerson(String name);

}
This commit is contained in:
Mark Paluch
2019-06-18 15:03:24 +02:00
parent 8064a6d1dd
commit 4f93fb830b
5 changed files with 107 additions and 13 deletions

View File

@@ -12,6 +12,7 @@ This chapter summarizes changes and new features for each release.
* Filter conditions for lightweight transaction update and delete (`UPDATE … IF <condition>`, `DELETE … IF <condition>`).
* Optimistic Locking support.
* Auditing via `@EnableCassandraAuditing`.
* Idempotency support in `@Query` annotation.
[[new-features.2-1-0]]
== What's new in Spring Data for Apache Cassandra 2.1