• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

B&S Booking lock issue

 
Fabio Kimura
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have the Bodgitt & Scarper assignment, and I am confused at the booking issue:

When a user decides to book a subcontractor, should I lock the record while the user is writing the customer Id?
Or should I lock only when the user clicks on "Book", in such a way that if two users both click at the same time, the "fastest" will successfully book the subcontractor, while the other will fail and receive a "Already booked" exception?

I implemented the last one (the easiest).

Please tell me how you implemented it, and if I am wrong by implementing the last way.

Thanks in advance!
 
Frans Janssen
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fabio,

I think you are on the right track. The purpose of locking is to allow business actions (such as booking a contractor) that cannot be performed using atomic database actions.

Frans.
 
Liang Anmian
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I agree that you are on the right track, since that IS the expected behaviour in the first place.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic