File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes lockCookie Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "lockCookie" Watch "lockCookie" New topic
Author

lockCookie

Matt Pavlovich
Ranch Hand

Joined: Aug 14, 2010
Posts: 98
I'm a bit confused here...Do I understand it correctly that when a record is locked, and a lockCookie is created for that specific Reservation object, that a new Reservation object is itself instantiated at that time (or just before)as well? The Reservation object then pulls the data that does not change from the database (like Smoking N), and takes on the data (like client Id) that is given to from the client side. Does this sound okay? That is the path I am getting ready to take but I just wanted to get some feedback before I travel down that road.

Thanks to everyone!
Matt
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2264
    
    3

Howdy, Matt!

Do I understand it correctly that when a record is locked, and a lockCookie is created for that specific Reservation object, that a new Reservation object is itself instantiated at that time (or just before)as well?


Hum... no. You don't have to instantiate it. In order to control the locked records and their corresponding owners, you can have a Map<Long, Long> in your Data class, where the key is the record number and the value is the cookie value. When a record is locked, you can just put this information in this map. Something like this:



Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Matt Pavlovich
Ranch Hand

Joined: Aug 14, 2010
Posts: 98
Hi Roberto,

Thanks very much...it is now ridiculously clear how simple that solution is. I have been sitting here too long. Time to give the brain a rest.

Thanks again.
Matt
Roberto Perillo
Bartender

Joined: Dec 28, 2007
Posts: 2264
    
    3

Alright, partner. Now, please, go take a nap!

But don't give yourself a hard time. I know exactly how you feel. It's just that some of the requirements may be hard to understand. But, that's why we're here!
 
wood burning stoves
 
subject: lockCookie