在同一列上的achilles cassandra中使用@ClusteringColumn和@Index

时间:2018-05-14 12:46:51

标签: java orm cassandra

我需要使用相同的列作为聚类列和二级索引。但是阿基里斯的编译失败了。

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(table="users")
public class Users{
    @PartitionKey
    @Column
    private String userID;

    @Index(name = "fname")
    @ClusteringColumn
    @Column
    private String fname;
}

但编译器抛出错误如下:

[ERROR] /D:/Work/Codebase/itam-common/schema/target/generated-sources/annotations/info/archinnov/achilles/generated/dsl/Users_SelectIndex.java:[466,44] method fname() is already defined in class info.archinnov.achilles.generated.dsl.Users_SelectIndex.E

我使用的是achilles-core:5.3.1和cassandra-driver-core:3.3.0

1 个答案:

答案 0 :(得分:0)

尝试为@Column@Index注释提供不同的名称:

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(table="users")
public class Users{
    ...
    @Index(name = "fname_idx")
    @ClusteringColumn
    @Column(name = "fname")
    private String fname;
    ...
}