Reputation: 271
What is the safe way to generate a ObjectId with String represnetation that will not collide in a distributed environment like Google App Engine (GAE) using Java?
Upvotes: 0
Views: 53
Reputation: 91
Do you need the actual key to be a string or do you just need a string representation of it under some circumstances? This answer might be relevant in the latter case: How to convert an integer to the shortest url-safe string in Python?
Upvotes: 0
Reputation: 1809
How about using java UUID? You can do a quick check for collision by fetching the newly generated ID.
Upvotes: 1