Selected Reading

Annotation @AllowFiltering with Query Methods



The concept Query methods and Custom Query methods are easily accessible here because the repository associated with CassandraRepository works on top of CrudRepository. Thus by default all the methods like save(), findOne(), findById(), findAll(), count(), delete(), deleteById() etc are accesible and can be used. The columns in Cassandra cant be used for query conditions unless Cassandra allows. For such query conditions and filtering related operations, we need to use an annotation on our queries called @AllowFiltering such as −

@AllowFiltering
Customer findByName(String string);

If we dont use this annotation we will get below error −

Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING
Advertisements