3 Replies - 173 Views - Last Post: 09 June 2020 - 08:17 AM Rate Topic: -----

#1 TheStudent555   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 53
  • Joined: 06-February 19

Can Java UUID guarantee uniqueness?

Posted 09 June 2020 - 07:48 AM

Currently making an application were a uuid is generated on the client then sent to a centralized server and saved in a database. There is a uuid column for each row that is set to unique. I was wondering if a collision would be possible, since the uuid generation is not centralized.
Is This A Good Question/Topic? 0
  • +

Replies To: Can Java UUID guarantee uniqueness?

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15724
  • View blog
  • Posts: 62,994
  • Joined: 12-June 08

Re: Can Java UUID guarantee uniqueness?

Posted 09 June 2020 - 07:51 AM

How are you generating the UUID?
Was This Post Helpful? 0
  • +
  • -

#3 TheStudent555   User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 53
  • Joined: 06-February 19

Re: Can Java UUID guarantee uniqueness?

Posted 09 June 2020 - 08:00 AM

Standard way, using the Java util library.

UUID uuid = UUID.randomUUID();
String randomUUIDString = uuid.toString();


Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 15724
  • View blog
  • Posts: 62,994
  • Joined: 12-June 08

Re: Can Java UUID guarantee uniqueness?

Posted 09 June 2020 - 08:17 AM

The docs would indicate it's collision proof as most well vetted UID generators.

I use them in SQL constantly and have yet to find an issue.

https://docs.oracle..../util/UUID.html
https://en.wikipedia...y_of_duplicates
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1