arashbi,
You can use a simple Java class that generates a unique 32-char ID every time it is called, and set the "generator" property of the ID to "assigned".
This simple Java method does that
Code:
/**
* returns a unique 32-char ID
* @return the ID
*/
public static String getHashableId(){
String key=new UID().toString();
key=StringUtils.repeat(key, 3);
key=key.substring(0, 32);
key=key.replace(':', '1');
key=key.replace('-', '2');
return key;
}
However, philosophically speaking, the fact that you absolutely need that ID before the object has being committed to the database is troubling. You should not ever need and ID unless it is from a class that had been inserted and has been properly retrieved my means of a query or load. You might want to reconsider your design.