hi, i want to know how to create GUID number in java ee , i am using jboss 4.2.3
+2
A:
import java.util.UUID;
UUID uuid = UUID.randomUUID();
String randomUUIDString = uuid.toString();
Otávio Décio
2010-08-02 13:14:53
+3
A:
import java.util.UUID;
...
UUID id = UUID.randomUUID();
When identifiers are used solely within a database, their generation should be left to the database itself. See Statement.getGeneratedKeys
stacker
2010-08-02 13:16:12
+1
A:
To generate UUID in Java you can use the java.util.UUID class. This class was introduced in JDK 1.5
import java.util.UUID;
UUID uuid = UUID.randomUUID();
String randomUUIDString = uuid.toString();
System.out.println("Random UUID String = " + randomUUIDString);
System.out.println("UUID version = " + uuid.version());
System.out.println("UUID variant = " + uuid.variant());
JuanZe
2010-08-02 13:20:35