What type of random unique value do you need? If it is a number, is there any reason why a sequence would not work? A sequence would produce unique values, although not random. If it is a random alphanumeric value you need, why not use java.util.UUID? You can see how to use this here (http://docs.oracle.com/javase/6/docs/api/java/util/UUID.html).