• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

URLyBird booking record

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 )
 
Ranch Hand
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic