diff --git a/src/main/asciidoc/reference/cassandra-repositories.adoc b/src/main/asciidoc/reference/cassandra-repositories.adoc index 09b06b77f..bd2d91f09 100644 --- a/src/main/asciidoc/reference/cassandra-repositories.adoc +++ b/src/main/asciidoc/reference/cassandra-repositories.adoc @@ -189,6 +189,9 @@ public interface PersonRepository extends CrudRepository { Person findFirstByShippingAddress(Address address); <6> Stream findAllBy(); <7> + + @AllowFiltering + List findAllByAge(int age); <8> } ---- <1> The method shows a query for all people with the given `lastname`. The query will be derived from parsing @@ -203,6 +206,7 @@ in `CustomConversions`. Throws `IncorrectResultSizeDataAccessException` if more <6> Uses the `First` keyword to restrict the query to the very first result. Unlike 5, this method does not throw an exception if more than one match was found. <7> Uses a Java 8 `Stream` which reads and converts individual elements while iterating the stream. +<8> Shows a query method annotated with `@AllowFiltering` that allows server-side filtering. ==== NOTE: Querying non-primary key properties requires secondary indexes. diff --git a/src/main/asciidoc/reference/reactive-cassandra-repositories.adoc b/src/main/asciidoc/reference/reactive-cassandra-repositories.adoc index 1a868d170..1c0c12d1a 100644 --- a/src/main/asciidoc/reference/reactive-cassandra-repositories.adoc +++ b/src/main/asciidoc/reference/reactive-cassandra-repositories.adoc @@ -83,12 +83,16 @@ public interface ReactivePersonRepository extends ReactiveSortingRepository findByFirstnameAndLastname(String firstname, String lastname); <3> Mono findFirstByFirstname(String firstname); <4> + + @AllowFiltering + Flux findByAge(int age); <5> } ---- <1> The method shows a query for all people with the given firstname. The query will be derived parsing the method name for constraints which can be concatenated with And and Or. Thus the method name will result in a query expression of `SELECT * FROM person WHERE firstname = :firstname`. <2> The method shows a query for all people with the given firstname once the firstname is emitted via the given `Publisher`. <3> Find a single entity for given criteria. Completes with `IncorrectResultSizeDataAccessException` on non unique results. <4> Unlike 3, the first entity is always emitted even if the query yields more result rows. +<5> Shows a query method annotated with `@AllowFiltering` that allows server-side filtering. ==== For JavaConfig, use the `@EnableReactiveCassandraRepositories` annotation. The annotation carries the very same attributes