博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Cassandra issue - "The clustering keys ordering is wrong for @EmbeddedId"
阅读量:4954 次
发布时间:2019-06-12

本文共 898 字,大约阅读时间需要 2 分钟。

在Java连接Cassandra的情况下, 当使用组合主键时, 默认第一个是Partition Key, 后续的均为Clustering Key.

如果有多个Clustering Key, 在Java中需指定Clustering Key的Order顺序, 否则将出现 "The clustering keys ordering is wrong for @EmbeddedId" 错误。

代码示例:

`@Entity(table = "table_name")

public class DemoDO {

@EmbeddedIdprivate CompoundKey id;public static class CompoundKey {    @PartitionKey    @Column(name = "filed_one")    public String fieldOne;    @ClusteringColumn(1)    @Column(name = "field_two")    private String fieldTwo;    @ClusteringColumn(2)    @Column(name = "field_three")    private Date fieldThree;    public CompoundKey() {    }    public CompoundKey(String fieldOne, String fieldTwo, Date fieldThree) {        this.fieldOne= fieldOne;        this.fieldTwo= fieldTwo;        this.fieldThree= fieldThree;    }   ...}@Column(name = "field_four")private String fieldFour;

...

}
`

转载于:https://www.cnblogs.com/developerERA/p/6424131.html

你可能感兴趣的文章
sqlite
查看>>
机电行业如何进行信息化建设
查看>>
Windows Azure Platform Introduction (4) Windows Azure架构
查看>>
【转】chrome developer tool 调试技巧
查看>>
mahout运行测试与kmeans算法解析
查看>>
互相给一巴掌器
查看>>
Android SDK环境变量配置
查看>>
VM10虚拟机安装图解
查看>>
9、总线
查看>>
Git 笔记 - section 1
查看>>
JZOJ 4.1 B组 俄罗斯方块
查看>>
HDU6409 没有兄弟的舞会
查看>>
2018 Multi-University Training Contest 10 - TeaTree
查看>>
HDU6205 card card card
查看>>
2018 Multi-University Training Contest 10 - Count
查看>>
HDU6198 number number number
查看>>
HDU6438 Buy and Resell
查看>>
HDU6446 Tree and Permutation
查看>>
HDU6201 transaction transaction transaction
查看>>
HDU6203 ping ping ping
查看>>