【发布时间】: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) {
..
}
}
【问题讨论】: