• Post Reply Bookmark Topic Watch Topic
  • New Topic

GUID generation in java  RSS feed

 
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys i need your suggestions

to how to wite a java application

for generating a GUID

i will be using this GUID as primary key in the table

in my application

regards
amir
 
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use the class java.util.UUID (new since Java 5). Look it up in the API documentation.

If you're using an older version of Java you can use class java.rmi.server.UID, but it is a little bit "less unique" than UUID.
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i will be using this GUID as primary key in the table

If you need this as a primary key, a GUID is probably overkill. A simple sequence will do the same job.
 
Amirtharaj Chinnaraj
Ranch Hand
Posts: 242
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes paul

i will be using this id as user id

i dont like users to know their id(primary key)

once they logged in

i want my user id similar to orkut
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!