【问题标题】:Cassandra - How to insert an UUIDCassandra - 如何插入 UUID
【发布时间】:2010-10-15 05:26:58
【问题描述】:

我正在使用 Cassandra 0.6.4,我正在尝试为列插入 UUID,但出现以下异常:InvalidRequestException(为什么:UUIDs 必须正好是 16 个字节)。插入 UUID 的正确方法是什么?谢谢!

我的列族定义为:

<ColumnFamily CompareWith="TimeUUIDType" Name="Comments"/>

代码片段:

        try {
            ColumnPath colPathname = new ColumnPath(COLUMN_FAMILY);
            colPathname.setColumn(colName.getBytes(ENCODING));
            client.insert(KEYSPACE, rowKey, colPathname, colValue, System.currentTimeMillis(), ConsistencyLevel.ONE);

        } catch (Exception exception) {
            ..
        }
    }

【问题讨论】:

    标签: cassandra uuid


    【解决方案1】:

    this 相同的问题。相同的解决方案:)

    (简短版本:您将行键与列名/键混淆了)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-05
      • 2011-09-08
      • 2018-08-13
      • 1970-01-01
      相关资源
      最近更新 更多