When I want a unique key for documents I'm partial to using @Unique(). I like that it's based on username and time.
Is there a way to get that from inside a Java bean?
If not, what's the best way to get a unique number in Java that would not repeat?
Thanks
This is what I use whenever I need a unique number:
String controlNumber = UUID.randomUUID().toString();
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