I am working on a web application related to Discussion forums using Java and Cassandra database.
I need to construct \'keys\' for the rows storing the user\'s details
Is this a distributed application?
Then you could use a simple synchronized counter and initialize it on startup with the next available id.
On the other hand a database should be able to handle the UUID hashes as created by java. This is a standard for creating things like sessionIds, that need to be unique. Your problem is somewhat similar since a session in your context would represent a set of user input.