On Thu, 2010-10-14 at 13:42 -0500, Eric Evans wrote:
> This list is for the development of Cassandra directly, your question is
> better posed on user@cassandra.apache.org (moving it there).
> 
> Before following up though, you might want to check the wiki and list
> archives, questions about creating TimeUUIDs from Java have been pretty
> common.  For example:
> 
> http://wiki.apache.org/cassandra/FAQ#working_with_timeuuid_in_java
> 
> On Thu, 2010-10-14 at 11:34 -0700, Wicked J wrote:
> > Hi,
> > I'm having issues with inserting data of TimeUUIDType in Cassandra v0.6.4.
> > The exception that I'm getting is: *InvalidRequestException(why:UUIDs must
> > be exactly 16 bytes)*
> > 
> > My objective is I want to insert comments and retrieve them in the order
> > they were inserted. My storage-conf.xml and code snippets are mentioned
> > below. Seems like the method "insert" in Cassandra.Client takes a String as
> > the id and in my case this value is actually a UUID and in the process of
> > converting the UUID (though 16 bytes in size) to String, the string value is
> > larger than 16 bytes which is causing the exception. 

The signature of insert() is:

  insert(String keyspace,
         String key, 
         ColumnPath column_path,
         byte[] value,
         long timestamp,
         ConsistencyLevel consistency_level)

So to store comments in a time-series manner use a TimeUUID *encoded to
a byte array* (byte[]) for the column attribute of column_path, with the
comment itself as the value (also as a byte[]).

-- 
Eric Evans
eev...@rackspace.com

Reply via email to