I want to use Hibernate to generate a unique primary key for an entity which is random - to use for purposes such as payment confirmation numbers, hotel room booking numbers, gift-card codes, etc. - any time a customer facing unique value is needed to identify an entity.
They should not be predictable by end users, but need not be cryptographically secure. The length must be 10 characters alphanumeric, using all capital letters.
There are a lot of similar questions, but none of them seem to actually solve the problem. I can't be the first one to have this issue.
I want to avoid the brute force method of just generating a random alphanumeric string and checking if it exists in the db or not.
Aucun commentaire:
Enregistrer un commentaire