2
votes

I have a webapp which uses Spring Data Cassandra framework with DataStax Driver. After configuring properly with connection points, I am able to fetch all rows with (.findAll) however not with specific queries I have created for ex:

 @Repository
 public interface PersonRepository extends CassandraRepository<Person>{
        @Query("select * from person where firstName = ?0")
        List<Person> findByUserName(String firstName);
 }

I have the following versions: Apache Cassandra: 2.1.15 ; Spring Data Cassandra: 1.4.3.RELEASE ; DataStax Driver : 2.1.9

ERROR:
 com.datastax.driver.core.exceptions.InvalidQueryException : unconfigured columnfamily person
   com.datastax.driver.core.exceptions.InvalidQueryException.copy(InvalidQueryException.java:50)
   com.datastax.driver.core.DriverThrowables.propagateCause(DriverThrowables.java:37)
   com.datastax.driver.core.DefaultResultSetFuture.getUninterruptibly(DefaultResultSetFuture.java:214)
   com.datastax.driver.core.AbstractSession.execute(AbstractSession.java:52)

Do you know if there is a version conflict? Looking forward to your help/suggestions.

EDIT/UPDATE: FOR THOSE WHO ARE STILL FACING ISSUES...THIS WORKS

 Added a keyspace and columnfamily name in the query; for ex: user.person
 @Query("select * from user.person where firstName = ?0")
1
Have you read the error message? You might want to check that you've set the appropriate keyspace in your configuration.mp911de

1 Answers

1
votes

Add the keyspace to the column family.

select * from [keyspace].person where firstName