• 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

B&S Questions about lock

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have one question about the lock mechanism of B&S, when in Spec of assigment says about owner field in data file: "customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale."

I think if i use this field and write data in this field to control my lock mechanism, this violate the spec, no ?

Another question is, when spec says in user interface topic:"It must allow the user to book a selected record, updating the database file accordingly."
Book a record wold a user lock record for any time and after a time free or update this record ? or the simple update operation cover this ? this is only for concurrent access to write in same record of file?

Sorry if this questions is not relevant or is repeated in this forum, i'm confuse about this.

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Carlos,

the problem seems: how to bring in the customer id when obtain a lock, there is no argument for the customer id in the lock method in my inderface. So you would need to lock the record to update it and then to update it to lock it by filling your customer id in? I see no way to make locks persistent in the db. Whether this wouold make sense at all, depends on the question: how long should the record be locked:
  • as long at is booked
  • just for the update
  • ...

  • Should the client request locking, or just the business logic in the server?
     
    Carlos Lacerda
    Ranch Hand
    Posts: 34
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Dear John ,


    This is a question, whats is expected when spec says "BOOK a Record",

    how long should the record be locked

    is the question.
    I try work in a solution for this problem today, i report here my solution for discursion.
    Thanks John.
     
    Bartender
    Posts: 2292
    3
    Eclipse IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    E ai Carlao!

    By book a room, it practically means that the customer ID field of a record will be updated. Since blank value in the customer ID field of a record means that it is available, then if it has an 8 digit number, it means that it is booked. You'll have to offer one JTextField in your GUI where the CSRs will enter any 8 digit number, and somehow it will update a record, that was previously chose by the CSR. In my case, the CSR clicks on the JTable to select a record, enters the 8 digit number and presses the "Book Room" button. This will update the customer ID field of that particular record.
     
    Carlos Lacerda
    Ranch Hand
    Posts: 34
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Grande Perillo,

    In my assigment spec is explicit for the user do not interage with this field see:
    |Desc| |field | |size | Description
    "Customer holding this record - owner - 8 - customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale."

    I not undestand this correctly.

     
    Roberto Perillo
    Bartender
    Posts: 2292
    3
    Eclipse IDE Spring Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Yes, the system you are creating does not interact with these numbers (like, they are not taken from a table that keeps the customers data). You just have to accept them, assuming that any 8 digit number provided is valid, you know? For instance, this is how the GUI of my project works: there's a JTable that shows all records in the database. There's an area that shows some data of the record that is selected in the JTable. When you click on any record, its data is shown in this area, which also has a JTextField where you insert any 8 digit number (it can be 98767433 or 16510200 or even 41610001! ). Then, when you click on the "Book Room" button, a JOptionPane.showConfirmDialog is shown, with some data of the room being booked, the number of the customer booking the room, and a phrase "Please make sure this information is correct. This action cannot be undone" (before you have this other doubt, I'll tell you now ). An "unbook" function is not required in this project (that is, updating the customer ID field so it is blank again), that's why I did not implement one (and another advice: stick to simplicity). When you confirm the booking of the room, the record is updated with that customer ID. Do not forget to make sure that the client updating that record has locked it first. You also have to check this in your delete method (note the comments of the lock method in your interface).

    If you have further questions, please let me know!
     
    Carlos Lacerda
    Ranch Hand
    Posts: 34
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Hi Perillo, thank you very much,

    Valuable comments for me.

    I try implement this lock now, my essay is scheduled for next Thursday.

    My essay have to be ready quickly.

    reply
      Bookmark Topic Watch Topic
    • New Topic