ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Don't Let Hibernate Steal Your Identity
Subject:   Uniqueness and UUID
Date:   2006-09-14 10:18:56
From:   icarr
Your second statement of requirements for the properties of an id was:


Is guaranteed unique, even across different VMs and different machines.


However as I understand it most implementation of UUID generator don't actually provide this?


In the article the randomUUID function from the 1.5 jre has in the javadoc


"The UUID is generated using a cryptographically strong pseudo random number generator."


hence two implementations could theoretically generate the same random number with the posible but unlikely outcome that across two systems or VM's on the same system we could generate the same UUID at the same moment in time.


Some implementations use the MAC address to 'spacially' separate machines, but two VM's on the same machine would have the same MAC. I presumably need to add in the PID (processID) to really separate the individual VM's. Unfortunately I can't obtain either of these pieces of information directly from within Java (JNI to the operating system seems to be a requirement?).


Have you come across an implementation that is absolutely guaranteed not to duplicate UID's making them truly UUID's?


I need to be able to generate keys on disconnected machines with an absolute guarantee that they will not duplicate when combined together in a central solution.


1 to 1 of 1
1 to 1 of 1