Why does the client need to generate a key for the database? The server should return this to the client instead.
In the windows world there exists a globally unique identifier called GUID. The GUID is guaranteed to be unique on all machines. It is a combination of the MAC address + Current Time + some other things. The idea is that the no. should be unique when generated on any machine at any time! You can generate such a unique no. easily on the client side. However, i would advise against clients generating Unique IDs for database keys. On Sep 8, 6:32 pm, Bohoej <[email protected]> wrote: > Hi > > I would like to be able to generate a random ID, which can be used as > a key in a database. I found a md5 implementation in javascript, which > works fine on the client side of my code, but not on the server side. > On the other hand I have also found alot of good examples of random > string generators to use on the server side, but they all use > libraries which are not usable on the client side. > > I am only thinking about md5 because it should be fairly unique. I > would like to be able to call the same function on both client and > server side, as I use this in connection with creation of data objects > that should be sent back and forth with GWT RPC, and if they dont have > an ID, I will generate it. This means that I need an algorithm for a > unique random string that can be translated by GWT. > > Any suggestions to a solution? > > /Morten --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en -~----------~----~----~----~------~----~------~--~---
