This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

lock & unlock again!

 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand this has been talked loooooooooooots of times already, but I still want to ask a couple of more regarding this.
First, do we really need to keep track of "who" locked the record when unlocking it? The spec. says
If an attempt is made to unlock a record that has not been locked by this connection, then no action is to be done.
Is "this connection" here the same as owner? How to identify the connection, then?
Second question: are we supposed to define the "record no" as in the input parameter of the methods? How? Should we virtually change the fields of the record?
Thanks a lot!
Cathy
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Cathy Young:
First, do we really need to keep track of "who" locked the record when unlocking it? The spec. says Is "this connection" here the same as owner? How to identify the connection, then?
Second question: are we supposed to define the "record no" as in the input parameter of the methods? How? Should we virtually change the fields of the record?
Thanks a lot!
Cathy

There is always debate on these topics. First My opinion is that you must make sure that the client that calls unlock for a record has that lock to begin with. And yes this "Connection" object handles it. Search on Connection Object here and you will learn a lot. Especially look for Peter's comments on it.
2. What is the signature of lock and unlock? Isn't (int recordNumber)?
2b. I changed the data when a person booked a seat.
Mark
 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

2. What is the signature of lock and unlock? Isn't (int recordNumber)?

Hi Mark, Thanks! Yes, it is the signature. But My problem is that recordNumber does not seem to be a field of the record. So are we supposed to "create" this field? Thanks!
Cathy
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Npe, don't need to create that field. I believe there is a method in one of the db package classes that will give you the record number.
I need to leave a little research on your side.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic