Hi Dave,
Originally posted by Dave Knipp:
Thats seems like a valid solution, it just seemed odd to me that a user could actually make an attempt to book a record, but then be rejected by the database. There has to be a better way
Thanks for your suggestions!
Dave
Another option is for your client to call lock() at the point where the user selects which record to update. You can then verify that the record is still available and inform the user if it is not. The problem with this is that the user may not be aware that they are holding the lock, and they could go out to lunch - any other client trying to gain a lock on that record would be blocked until the first client returned. This could be partially alleviated if you had an isLocked() method and/or a lockWithinTimeframe() method, but it is still pretty ugly.
Another option is to propogate updates to the client. So when client A updates a record, the server sends the update to clients C, D, E ... This is beyond the requirements of the specification though, and it might get annoying to the clients if there were enough bookings happening - the screen would be continually refreshing.
Hmmm, so many design decisions, and whatever you choose has to be documented
FWIW, having worked in the airline industry for too many years, I can tell you that they work as per the suggestions above - what you see on the see on the search response screen is dated from the moment you get it, and when you attempt to book a seat you can easily get a response back telling you that the seat that you saw as available has already been booked.
Regards, Andrew