我需要使用与聚类列和二级索引相同的列。但是跟腱编译失败。

@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

最佳答案

尝试为@Column@Index批注指定其他名称:

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

10-05 23:08
查看更多