This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Two clients are running. Both clients (correctly) see no booked records in the database. Client 1 books a record X by placing a customer id of 12345678 against the record as the records owner. Client 2's GUI is still showing no owner for record X.
1 - Can client 2 place a customer ID of 87654321 against record X ?
My guess is no. What I think should happen is that you can only place a customer ID against a record if there is no ID against the record already, regardless of whether or not your GUI shows it.
So if this is the case - my next question is:
2 - Can client 2 return record X even if it was client 1 which booked the record?
If the answer to question 2 is, only client 1 (ie the client who booked the record) may return the record, what happens if client 1 terminates. Does that mean that record is forever booked?
Of course double bookings are not allowed. You don't want to arrive at a hotel and discover 2 couples booked the same room, no romantic weekend for you and your partner. So when client 2 wants to book an already booked record (although it seems to be available according to the GUI) an error "Room/contractor already booked. Please book another one." should be shown.
You should also make sure that the time a record is locked is as short as possible. So instead of already locking a record when the "book dialog" is shown (where you can enter the customer id), you should start the booking process (lock/update/unlock) after the user confirmed the "book dialog".
If client 1 terminates and has booked record 1, record 1 will remain booked forever (because there is no unbooking functionality). But it's quite normal a booking is booked forever (I booked a holiday at the end of October, so I hope it's still booked at the end of this month when I'm actually on holiday )