JavaRanch is a community of people from all over the world, many of who are not native English speakers. While using abbreviations like "u" instead of spelling out "you" is convenient when text messaging your friends on a cell phone or in a chat room, it presents an extra challenge to those that are already struggling with English. Additionally, such shortcuts may confound automated translation tools that patrons of the Ranch may be making use of.
I would like to ask for your help in making the content of JavaRanch a little easier to read for everybody that visits here by not using such abbreviations.
If I take your question literally the answer is neither. Perhaps you could post what you want to achieve through this locking and describe a short scenario? That way we can advise you on the best approach. You certainly shouldn't be considering thread synchronisation in Java to achieve this.
Originally posted by Julian Kennedy:
Do you select the data for the customer to update into the web tier first? That is, could two users be looking at/updating the same record at the same time? Is that what you're talking about? If so the optimum approach depends on how frequently you expect to get a collision. Frequent collisions require a pessimistic locking strategy; occasional/infrequent/rare collisions suggest an optimistic locking strategy would be most appropriate.
julian, I feel you are the one who can give me the answers. Please, please continue on describing the details of optimistic and pessimistic locking methods. I want to know ---
1. what kind coding I need to do ?
2. what kind special SQL or database work I need to do ?
Of course I can give you the answers, but I'm not going to do the work for you. That's your job. If you answer my questions then maybe I can help further. I suggest you also search the web to help you to better understand the terms I've mentioned. If you run into trouble trying to implement one of the locking strategies or you feel you need further pointers I'd be happy to help.