You are using the wrong part of the example. That code sample just produces the string representation. Scroll down in that FAQ entry to the sample labeled:
"When you want to actually place the UUID into the Column then you'll want to convert it like this. This method is often used in conjuntion with the getTimeUUID() mentioned above." b On Fri, Aug 27, 2010 at 12:28 AM, Sean Bowman <pico...@gmail.com> wrote: > I'm at my wits end with Cassandra; is 0.6.4 just broken? I've created a very > simple keyspace: > > <Keyspace Name="MyApp"> > <ColumnFamily Name="History" CompareWith="TimeUUIDType"/> > > Using the Thrift sample code for 0.6 on the wiki, and the FAQ about > TimeUUID's and Java, I tried to generate a GUID using this method: > > String key = new com.eaio.uuid.UUID().toString() > > Since all the Thrift get and insert statements use Strings for the keys. But > when I send one of these GUID's, I get: > > Exception in thread "main" InvalidRequestException(why:UUIDs must be > exactly 16 bytes) > at > org.apache.cassandra.thrift.Cassandra$insert_result.read(Cassandra.java:12295) > at > org.apache.cassandra.thrift.Cassandra$Client.recv_insert(Cassandra.java:675) > at > org.apache.cassandra.thrift.Cassandra$Client.insert(Cassandra.java:648) > > I even tried something like: > > client.insert(keyspace, new String(asByteArray(getTimeUUID()), path, > "Some value".getBytes("UTF-8"), timestamp, ConsistencyLevel.ONE); > > Can anyone point me in the direction of how I send a time-based UUID to > Cassandra 0.6.4 through the Java Thrift client? Or am I missing the point of > all of this somehow?