i want to know how to create GUID number in java ee , i am using jboss 4.2.3
To Generate a GUID in Windows 10 with PowerShell, Type or copy-paste the following command: [guid]::NewGuid() . This will produce a new GUID in the output. Alternatively, you can run the command '{'+[guid]::NewGuid(). ToString()+'}' to get a new GUID in the traditional Registry format.
Overview. UUID (Universally Unique Identifier), also known as GUID (Globally Unique Identifier) represents a 128-bit long value that is unique for all practical purposes.
In Java, the randomUUID() static method is used to generate a random UUID. The method internally uses SecureRandom class, which provides a cryptographically strong random number generator. Every UUID is associated with a version number. The version number describes how the UUID was generated.
import java.util.UUID;
UUID uuid = UUID.randomUUID();
String randomUUIDString = uuid.toString();
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
UUID Javadoc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With