• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URLyBird booking record

 
Tim Anlauf
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scenario :

Client A pushs button "book" -> dialog opens ( lock is invoked )
Client B pushs button "book" -> dialog opens ( try to get lock )

Client B have to wait till Client A closes the dialog ( unlock )
But maybe Client A is going to dinner... and still leaves the dialog open

Maybe someone has an idea how to solve this easlily ?
Maybe one solution is to get the lock when diaolg close ( lock/update/unlock ), but this solution isn't really good. ( because someone could override the customer id )
 
Mark Smyth
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think that lock / unlock ought to be called by the GUI when a dialog box opens. You need to reconsider your design to include a layer between GUI and DB between to handle the locking and unlocking so keep the locking times minimal. Something like the followin ought to do:

(User inputs ID presses "book" button)


If there are two clients trying to book, the second one should get an error saying that the room is already booked.
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I daresay this locking mechanism is not invoked by the client application. It would be too dangerous to trust the client applications to be responsible with the record locks.

Client applications may die any moment leaving locked records on the server.

I built a business-aware wrapper class over my DBAccess implementation, and that class is responsible for the locking mechanism to be used.

Refining previous example I do it this way:


[ October 19, 2006: Message edited by: Edwin Dalorzo ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic