@Select 在没有参数而不是选择所有实体时引发错误(Datastax Java Driver Mapper)

@Select raise error when with no parameters instead selecting all entites (Datastax Java Driver Mapper)

我正在使用 Datastax Java Driver Mapper。 Doc 和 Github 描述了使用不带参数的 @Select 注释的可能性 select table.

中的所有行

https://docs.datastax.com/en/developer/java-driver/4.4/manual/mapper/daos/select/

https://github.com/datastax/java-driver/pull/1285

所以我做了以下事情:

@Dao
public interface SchaduleJobDao {
(...)

   @Select
   @StatementAttributes (consistencyLevel = "LOCAL_QUORUM")
   PagingIterable<ScheduleJobEntity> all();
(..)

但是,Eclipse 在 all() 方法行中引发错误:

"Invalid parameter list: Select methods that don't use a custom clause must take the partition key components in the exact order (expected PK of ScheduleJobEntity: [java.lang.String])"

根据上面的参考,应该是允许的。

我确实检查了版本,4.2 之前这个功能应该可以工作,我使用的是 4.4。所以它似乎与版本无关。 我的 pom 文件:

<dependency>
   <groupId>com.datastax.oss</groupId>
   <artifactId>java-driver-mapper-processor</artifactId>
   <version>4.4.0</version>
</dependency>

我可能做错了什么?有什么方法可以解决这个问题?

谢谢

我认为这可能是配置问题。你能检查一下你的 POM 没有在另一个地方引用旧版本的处理器吗?特别是,另一种提供它的方法是在编译器插件的 annotationProcessorPaths 部分中,如 here.

所示

我们有一个涵盖此案例的 integration test,我只是仔细检查它是否在 4.4.0 中通过。另外,引入该功能后,错误消息略有变化,以前是"must take the partition key components",现在是"must match";你引用的是旧消息。