I have a Table in my Cassandra Cluster built using these commands:
CREATE KEYSPACE IF NOT EXISTS activitylogs WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
CREATE TABLE IF NOT EXISTS activitylogs.activities2 (
activity_id timeuuid,
actor_id text,
app_id text,
item_id text,
viewer_id text,
activity_type int,
ts timestamp,
PRIMARY KEY (actor_id, activity_id, app_id)
) WITH CLUSTERING ORDER BY (activity_id DESC, app_id ASC);
This is what my Repository in Spring Project looks like:
public interface ActivityRepository extends CassandraRepository<Activity> {
@Query("SELECT actor_id FROM activities2 WHERE actor_id='actorA'")
Iterable<Activity> findByActor_Id(String actor_Id);
}
Now, when I access the endpoint associated with this query retriever , I get the following error:
Invalid null value in condition for column actor_id
at com.datastax.driver.core.Responses$Error.asException(Responses.java:136)
However, when I run the equivalent CQL command in CQLSHell I get the exact row I was looking for...
Why is this happening ?
There was a mistake in writing the controller for the SpringBoot app.
The proper controller is thus:
Earlier implementation (at the time of writing the question) did not have @PathVariable annotation hence, controller wasn't passing any value to the repository interface function.