I'm using SpringBoot, JPA and Hibernate.
I have a doubt.
For my entities I need to have an UUID as primary key (and I would like to save this id in "clear mode" (string) and not binary)
I'm using this code:
@Id
@Column(name = "id")
@Type(type = "uuid-char")
private UUID uuid = UUID.randomUUID();
My doubt is this: Is this approach safe? Can I be sure ids will always be unique?
I understand that, using this code, the UUID will be generated code side so, what's happen if I will have multiple instances for my service using the same DB service for all instances?
Is it possible that more instances will generate the same UUID?