在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. 关于IP选项

    源:关于IP选项 校验和算法

  2. WebView点击图片看大图效果

    在webViewDelegate里面添加如下代码: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 - (voi ...

  3. java.lang.UnsupportedClassVersionError: com/T : Unsupported major.minor version问题解决

    编译的时候jdk版本为1.8 2.运行的时候jdk版本为1.7 解决办法:将编译的jdk版本降为1.7,问题解决

  4. 360路由器设置网段ip

    路由器设置->高级设置->修改路由器地址

  5. JavaScript高级程序设计-13:事件

    JavaScript与HTML之间的交互是通过事件实现的. 一.事件流 首先我们要明白事件流的概念.当我们点击一个按钮时,也点击了按钮的容器元素,甚至也点击了整个事件.事件流描述就是从页面中接收事件的 ...

  6. 后端数据库使用 Bomb方案

    不再需要阿里云进行部署: http://docs.bmob.cn/ios/faststart/index.html?menukey=fast_start&key=start_ios

  7. HNU 13074 Goldbach’s Conjecture 解题报告

    题目大意:输入一个偶数(x<32000),输出这个偶数是由哪两个素数相加所得. 比如:一个偶数26,它可以是3+23,7+19,13+13,这些素数相加所得. 输入输出样例: Sample In ...

  8. WebSocket协议再认识

    WebSocket出现之前 在线聊天室.在线客服系统.评论系统.WebIM等这些应用有一个共同点,就是用户不需要去刷新浏览器就能够从服务器获得最新的数据,这就用到了推送技术. WebSocket出现之 ...

  9. 使用AIR进行移动APP开发常见功能和问题(下)

    1.  Air如何判断android.ios 平台网络连接状态? Android,使用as3原生api: if(NetworkInfo.isSupported)//只有android支持 Networ ...

  10. android studio导入矢量svg图标技巧

    1.在android studio中打开File-->Settings-->Plugins,在Plugins中输入SVG2VectorDrawable搜索插件,并安装. 2.安装完成重启a ...