DATACASS-611 - Add query derivation for delete queries.

We now support query derivation for delete queries using delete…By in method declarations.

interface PersonRepository extends Repository<Person, String> {

  void deleteWithoutResultByLastname(String lastname);

  boolean deleteByLastname(String lastname);
}
This commit is contained in:
Mark Paluch
2019-06-18 17:20:41 +02:00
parent 4f93fb830b
commit f8d87e24bd
14 changed files with 194 additions and 11 deletions

View File

@@ -13,6 +13,7 @@ This chapter summarizes changes and new features for each release.
* Optimistic Locking support.
* Auditing via `@EnableCassandraAuditing`.
* Idempotency support in `@Query` annotation.
* Query derivation for <<cassandra.repositories.queries.delete,`DELETE` queries>>.
[[new-features.2-1-0]]
== What's new in Spring Data for Apache Cassandra 2.1

View File

@@ -282,6 +282,25 @@ lower / upper bounds (`>` / `>=` & `<` / `<=`) according to `Range`
|===
[[cassandra.repositories.queries.delete]]
== Repository Delete Queries
The keywords in the preceding table can be used in conjunction with `delete…By` to create queries that delete matching documents.
====
[source,java]
----
interface PersonRepository extends Repository<Person, String> {
void deleteWithoutResultByLastname(String lastname);
boolean deleteByLastname(String lastname);
}
----
====
Delete queries return whether the query was applied or terminate without returning a value using `void`.
include::../{spring-data-commons-docs}/repository-projections.adoc[leveloffset=+2]
[[cassandra.repositories.queries.options]]
@@ -297,6 +316,7 @@ The declared consistency level is applied to the query each time it is executed.
The following example sets the consistency level to `ConsistencyLevel.LOCAL_ONE`:
====
[source,java]
----
public interface PersonRepository extends CrudRepository<Person, String> {