【发布时间】:2017-05-20 03:54:39
【问题描述】:
我有一个使用 Spring Data Cassandra 框架和 DataStax 驱动程序的 web 应用程序。正确配置连接点后,我可以使用 (.findAll) 获取所有行,但不能使用我为 ex 创建的特定查询:
@Repository
public interface PersonRepository extends CassandraRepository<Person>{
@Query("select * from person where firstName = ?0")
List<Person> findByUserName(String firstName);
}
我有以下版本: 阿帕奇卡桑德拉:2.1.15; Spring Data Cassandra:1.4.3.RELEASE; DataStax 驱动程序: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)
你知道是否有版本冲突吗?期待您的帮助/建议。
编辑/更新:对于那些仍然面临问题的人......这工作
Added a keyspace and columnfamily name in the query; for ex: user.person
@Query("select * from user.person where firstName = ?0")
【问题讨论】:
-
您是否阅读了错误信息?您可能需要检查您是否在配置中设置了适当的键空间。
标签: java cassandra spring-data datastax datastax-java-driver