I am currently implementing all the CRUD methods that are in the supplied interface, and of course my Data class. I have URLyBird 1.2.2. Here's my update method signature: I have my cookie generator done, no problem there. I added another method inside Data like this:
I call this method from inside lockRecord(long recNo) like this: All good, except for update, which has the lockCookie as a parameter in its method signature. I am wondering if I should ignore it, and just generate another one with the passed in record number (how I did it for the other 2), or rethink my design? I am trying to think how Sun will test my application. Create, update and delete will never be called from the client, so not sure how the parameters will be sent in. I know how I will send them in. I'm just confused Any and all help is appreciated!
Thanks all! I do have to redo this. Delete has the cookie as a parameter too, create is the only one that doesn't. Alecsandru, you are so right. Maybe I need to use the timestamp with the number to generate the cookie. I think many others have taken this approach.
posted 11 years ago
I used System.nanoTime(), but you can also use Random, just don't generate a new one at every call (it also affects performance). Just have a static or member Random and use that one.