Cassandra - How to insert an UUID
I'm using Cassandra 0.6.4 and I'm trying to insert an UUID for a column and I get an exception of: InvalidRequestException(why:UUIDs must be exactly 16 bytes). What is the correct way to insert an UUID? Thanks!
My column family is defined as:
<ColumnFamily CompareWith="TimeUUIDType" Name="Comments"/>
Code Snippet:
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) {
..
}
}
Same problems as this. Same solution :)
(short version: you are confusing row key with column name/key)
精彩评论