cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaron morton <aa...@thelastpickle.com>
Subject Re: UUID - Java
Date Thu, 03 Jan 2013 19:20:47 GMT
There are several classes of UUID, so it depends a little on what the call to com.eaio.uuid.UUID()
is doing. In general you will be ok.

In general you can assume it's unique, however version 1 time UUID's may not be. As they contain
a time component and the machine mac address, which is sometimes zero'd out so you can reproduce
a UUID for a specific time. See http://en.wikipedia.org/wiki/Universally_unique_identifier#Version_1_.28MAC_address.29
and http://wiki.apache.org/cassandra/FAQ#working_with_timeuuid_in_java

 Hope that helps. 

-----------------
Aaron Morton
Freelance Cassandra Developer
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 4/01/2013, at 2:26 AM, "Hiller, Dean" <Dean.Hiller@nrel.gov> wrote:

> Another option is PlayOrm UniqueKeyGenerator.generateKey().  While it is not returning
a UUID, it does return a unique key for a specific cluster that is nice and short too.
> 
> Dean
> 
> From: Baskar Sikkayan <techbaski@gmail.com<mailto:techbaski@gmail.com>>
> Reply-To: "user@cassandra.apache.org<mailto:user@cassandra.apache.org>" <user@cassandra.apache.org<mailto:user@cassandra.apache.org>>
> Date: Thursday, January 3, 2013 3:00 AM
> To: "user@cassandra.apache.org<mailto:user@cassandra.apache.org>" <user@cassandra.apache.org<mailto:user@cassandra.apache.org>>
> Subject: UUID - Java
> 
> Hi,
>  I use the following code to generate the primary key.
> 
> public static java.util.UUID getTimeUUID() {
> 
>        return java.util.UUID.fromString(new com.eaio.uuid.UUID().toString());
> 
>    }
> 
> Is this the correct approach?
> 
> Do let me know if there i any better approach which guarantees no conflicts.
> 
> Thanks,
> Baskar.S


Mime
View raw message