Originally posted by Sarath Koiloth Ramath:
I know how to create those sequence..but how to implement these thing in every request.Every time i had to check the database wheather these Id is already taken or not.
You can either:
1) Always maintain the highest unique ID in your application. This way you don't have to query the DB everytime. Just pull out the current highest ID on application start up.
2) Come up with an algorithm which will always give you an unique ID. Using the system time in milliseconds might be one of the ways to achieve this. You can further convert this long to say Hex and store it as a
String to achieve the alpha numeric requirement.