在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 {

@EmbeddedId
private 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;

...

}

`

Cassandra issue - "The clustering keys ordering is wrong for @EmbeddedId"的更多相关文章

  1. Cassandra Issue with Tombstone

    1. Cassandra is quicker than postgre and have lower change to lose data. Cassandra doesn't have fore ...

  2. Cassandra key说明——Cassandra 整体数据可以理解成一个巨大的嵌套的Map Map<RowKey, SortedMap<ColumnKey, ColumnValue>>

    Cassandra之中一共包含下面5种Key: Primary Key Partition Key Composite Key Compound Key Clustering Key 首先,Prima ...

  3. 如何用 JIRA REST API 创建 Issue

    简介 最近需要把一个Excel里的issues list全部到JIRA上create 一遍, 总不能手动创建百十来个issues吧, 本文讲述一下如果调用JIRA提供的Rest API 来自动创建is ...

  4. 未压缩的jQuery

    /*! * jQuery JavaScript Library v3.4.1 * https://jquery.com/ * * Includes Sizzle.js * https://sizzle ...

  5. sizzle源码分析 (1)sizzle架构

    sizzle是jquery的核心,它用来选择匹配的元素,其代码包含在一个匿名函数中,并以window作为其上下文环境: (function( window, undefined ) { //此处为si ...

  6. JavaScript中创建字典对象(dictionary)实例

    这篇文章主要介绍了JavaScript中创建字典对象(dictionary)实例,本文直接给出了实现的源码,并给出了使用示例,需要的朋友可以参考下 对于JavaScript来说,其自身的Array对象 ...

  7. Sizzle一步步实现所有功能(基本筛选)

    第二步:实现:first,:last,:eq(),even,odd,:gt(),:lt(); :header,:root,:taget; :not(). ;(function( window ){ v ...

  8. Sizzle一步步实现所有功能(层级选择)

    第二步:实现Sizzle("el,el,el..."),Sizzle("el > el"),Sizzle("el el"),Sizzl ...

  9. [转]Android图片下载

    因为国内被墙,看起来不方便,转载下,原文地址:http://android-developers.blogspot.com/2010/07/multithreading-for-performance ...

随机推荐

  1. php 中文切割字符串长度

    function msubstr($str, $start=0, $length, $charset="utf-8", $suffix=true) { if(function_ex ...

  2. Dom编程(二)

    document是window对象的一个属性,因为使用window对象成员的时候可以省略window.,所以一般直接写document  document的方法: (1)write:向文档中写入内容. ...

  3. js生成随机数

    //生成n以内的随机数 function getRandom(n){ return Math.floor(Math.random()*n+1) } //生成1000以内的随机数 alert(getRa ...

  4. 深入了解Bundle和Map

    [转]http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0402/2684.html 前言 因为往Bundle对象中放入Map实际上 ...

  5. 6.UDP协议

    1.UDP简要介绍 UDP是传输层协议,和TCP协议处于一个分层中,但是与TCP协议不同,UDP协议并不提供超时重传,出错重传等功能,也就是说其是不可靠的协议. UDP数据报结构: UDP首部格式: ...

  6. word页眉页脚 首页 索引 正文各不同的处理方法

    1.在目录和正文之间,加入分隔符——分节符——下一页,然后再添加页眉页脚,然后再添加索引:

  7. iOS 设置控件圆角、文字、字体

    以按钮为例: UIButton btn = [UIButton new]; btn.layer.masksToBounds = YES; btn.layer.cornerRadius = 10.0; ...

  8. Android性能优化(一)之启动加速35%

    一.前言 随着项目版本的迭代,App的性能问题会逐渐暴露出来,而好的用户体验与性能表现紧密相关,从本篇文章开始,我将开启一个Android应用性能优化的专题,从理论到实战,从入门到深挖,手把手将性能优 ...

  9. 利用JS做到隐藏div和显示div

    div的visibility可以控制div的显示和隐藏,但是隐藏后页面显示空白 style="visibility: none;" document.getElementById( ...

  10. mysql 子查询优化

    今天用到要查询七天内都没有装机的门店信息,首先想到了用not in,先把装机的userid查出来,然后再id not in,但是这样就必须使用子查询,数据量少还可以,数据量大了的话,肯定效率特别低,因 ...