cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Julien <pjul...@gmail.com>
Subject Re: Problem with UUID
Date Fri, 08 Apr 2011 22:06:17 GMT
I think this is what you're looking for

http://wiki.apache.org/cassandra/FAQ#working_with_timeuuid_in_java

2011/4/8 Олександр Силка <sylkaalex@gmail.com>:
>
> Then how i can generate correct time UUID key in java ?
>
> 8 квітня 2011 р. 22:58 Ed Anuff <ed@anuff.com> написав:
>>
>> Hmm, if you're really doing this, you're not getting a time uuid:
>>
>>  UUID timeUUID = getTimeUUID().randomUUID();
>>
>> That call to randomUUID() is invoking the static randomUUID() method
>> in java.util.UUID which is generating a non-time random uuid.  I'm not
>> sure why you're getting that error message though.
>>
>> Ed
>>
>> 2011/4/8 Олександр Силка <sylkaalex@gmail.com>:
>> > Hi everyone,
>> > I have column family called site sorted
>> > by org.apache.cassandra.db.marshal.TimeUUIDType.
>> > When I try to save some data using hector i get next
>> > message InvalidRequestException(why:TimeUUID should be 16 or 0 bytes
>> > (3)).
>> > My Cassandra version 0.7.0
>> >
>> > This is snippets of my code:
>> > public static java.util.UUID getTimeUUID() {
>> > return java.util.UUID.fromString(new com.eaio.uuid.UUID().toString());
>> > }
>> > UUID timeUUID = getTimeUUID().randomUUID();
>> > List<HColumn<String, String>> columns = DaoHelper.getStringCols(site);
>> >  Mutator<UUID> mutator = HFactory.createMutator(keyspace,
>> > UUIDSerializer.get());
>> >  for (HColumn<?, ?> column : columns) {
>> >           mutator.addInsertion(timeUUID, columnFamilyName, column);
>> >  }
>> > I am new in Cassandra and i really want to understand how it works.So
>> > please
>> > help me.
>
>

Mime
View raw message