How does optimistic version locking work

Hi,
I have below questions regarding toplink with optimistic version locking vs pessimistic locking after checking the developer guide:
in the guide, it suggests optimistic version locking oppose row level locking with select for update.
if use optimistic version locking, additional column is required in database for each table and it keeps version of each row via toplink, how does toplink keeps the version technically, does it have triiger or other procedure installed in DB for this tacking between DB and Apps cache? how does the version gets incremented and what is the max value for it?
if there are many rows in the table, how is the performance on the database level as each update statement need to verify the version of each record or it is all done on the apps cache?
Thanks.

It is quite simple
With optimistic locking you have extra column in database which transfer to another attribute in your object.
So when your application reads such object it has ID (primary key) and another attribute with version.
When you persist changes to object that attribute value (read when object was read from db) i added to query, so you have something like:
update xxxx set y = z,.... , version = version + 1 where id = <your obj id> and version = <current attribute value>
That way if another session updated such object your update won't work because there is no row in table with id and version of your object.
Assumption is that there is low concurrency and you are the only one editing that object (thats why its optimistic)
There is no max value for it other then database field limit. It is incremented at every update by adding that increase to sql send to db, so no trigger/procedure is needed.
As to performance - it is usually better then pessimistic locking but some of updates can fail, and since tables are accessed by primary key anyway additional condition for value shouldn't have much performance impact.

Similar Messages

  • How does the time machine work

    how does the time machine work....I need to find an older version of a document...

    Hi mogburn,
    Time Machine is part of the System software, not a feature of the word processing and page layout application, Pages, the topic in this community.
    That said, Time Machine is pretty easy to get into.
    In the Finder, open the folder containing the current version of the file.
    Select the file, then click on the Time Machine icon in the menu bar and choose Enter Time machine.
    The folder window will move to the center of the screen, and two arrows will appear near the lower right corner of the window.
    Click the one pointing back to go back in time, and the one pointing toward the front (of the computer) to return to the present. The display will stop at each saved version of the file along the way.
    Need more details? Try asking in the Mac OS X v10.6 Snow Leopard community.
    Regards,
    Barry

  • For the iPod Classic, in settings, how does the volume limit work? After setting a limit, how to re-set to a new volume limit?

    For the iPod Classic, in settings, how does the volume limit work? After setting a limit, how to re-set to a new volume limit?

    This thread - with a quote from an LR4 Beta thread - says that all 6 central Basic controls in PV2012 (Exposure thru Blacks) are now image-adaptive, as were Recovery, Fill Light, and Clarity in previous versions:
    http://forums.adobe.com/message/4253485
    Whether they are suitable for creating a Timelapse sequence without significant flicker is entirely subjective and up to you - and of course, dependant on your specific images & how they change over time.  Sorry, not much advice beyond try PV2012, and revert back to PV2010 if you get too much flicker.

  • How does the Convert Command Work Under the Catalogue Manager?

    How does the Convert Command Work Under the Catalogue Manager?

    My suggestion would be that you download the pdf version of the organizer help file:
    http://helpx.adobe.com/pdf/elements-organizer_reference.pdf
    Start with page 57 for catalogs.
    I am sure you'll have a better understanding of backup/restore and converting when you understand what a catalog is.
    Please come back with your questions afterward .

  • Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own? If each has their own does each id have to buy their own music and apps? How does find my iphone work with one apple id or two? also I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?

    Is it possible to have your whole family on one apple id or is it better to have each person have there own?
    Yes, it is possible. 1 apple ID can be associated with up to 10 devices.
    If each has their own does each id have to buy their own music and apps?
    Yes, all purchases are non-transferable.
    How does find my iphone work with one apple id or two?
    Every device associated with one apple ID through Find my iPhone is tied to that Apple ID; Find my iPhone will work in the same way with up to ten devices associated with one apple ID. You cannot enable Find my iPhone for one device across two apple IDs
    I am going to be going off to college soon should I make an itunes id for my self and how will I get all the music from the old id?
    If you have authorized a computer with the old apple ID, you can transfer old media purchased through the old to other devices via iTunes. This doesn't mean the media purchases through the old apple ID it transferred to the new account. If you plan to make future purchases and don't wish to share them with others, make your own apple ID.

  • How does this IMPORT statement works

    can any one tell me how does this statement will work..
    I am wokring on Solution manager system , where in there is a function module SSF_FIELD_LIST
    to which system passes form name.
      import fields to fieldlist
             from database stxfcontr(sf) id l_fullname.
    stxfcontr is a table which contains value of in  a diff
    Regards,
    mayank

    It will import data object stored in memory under named fields to your custom data object fieldlist .
    The table which it is stored is name stxfcontr under RELID (memory area) SF .
    Cluster key (key of the entry) in that table is behind var l_fullname
    Anyhow I think [this link|http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3bf8358411d1829f0000e829fbfe/frameset.htm] is more that any explanation. Once you study it, you will understand the above.
    Regards
    Marcin

  • How does the event structure work & ...

    How does the event structure work & and how to modify the case example if you want to change the name of the case? I haven't a look at the manual but nothing about event structure is mentioned.

    I know how it works.. =P

  • How does "notify me" actually work in mail app

    Might be a daft question, but how does "notify me" actually work in iPhone email app?
    I get the principal but surely when you get a reply thats already noticed you?
    Could someone advise me how it actually notifies and is it in addition to receiving the reply to the mail?

    I have the columns in place. But I have a few questions -
    1. Iis there some kind of audit trail report on the updates to my record to the table? If so how do I get to see?
    2. Am I expected to create a <entity name>_HISTORY table for this to work? I see some such recommendation  here .

  • How does mix and match works in ECC6.0?

    How does mix and match works in ECC 6.0?
    Can some shared on this topic?
    Thanks in advance

    It;s a term used in Retail for combination of sales item eg buy 3 get 1 any other  @ xx price.

  • How does the verizon wifi work? Do you pay monthly?

    I want to buy the new iPad with retina display as a gift, but how does this verizon wifi work? Do you pay monthly or have to call Verizon?

    You're post is a little confusing. WiFi signals are not done through Verizon unless you are talking about using a Verizon MiFi hotspot such as this http://www.verizonwireless.com/b2c/store/controller?&item=phoneFirst&action=view PhoneOverviewByDevice&deviceCategoryId=13&cmp=KNC-58700000028195084&zipRdr=y.
    4G wireless cell signals are done through Verizon. WiFi comes from places such as your home wireless network, or WiFi hotspots at places like Starbucks, restaurants, pubs, etc.
    If you are asking about Verizon's wireless cell service, it's $20 a month for 1 gig of data, $30 a month for 2 gigs of data, or $50 a month for 5 gigs of data.

  • How does the notify() call work in Java?

    Hi!
    Can someone help me:
    How does the notify() call work in Java?
    H�var

    Java's Thread Tutorial
    JavaWorld: Introduction to Java threads
    IBM: Introduction to Java threads
    Google: java+threads+tutorial

  • How does the copy button work in safari for ipad (copy button under facebbok share button)?

    How does the copy button work in safari for ipad (copy button under facebbok share button)?

    On a website ...  
    Tap the Action icon bottom of that window. (white square with a right facing arrow) then tap Facebook.
    You should see the following depending on the what content the website can share.
    Copy / Mail / Message / Twitter / Print  / Bookmark

  • How does the Passbook application work? How am I able to import my plane ticket, concert ticket etc into Passbook?

    How does the Passbook application work? How am I able to import my plane ticket, concert ticket etc into Passbook?

    Try the following to fix the iTunes Can't Connect issue that you are having:
    Open Settings.
    Open General.
    Open Date & Time.
    Switch the Set Automatically setting to Off.
    Open Set Date & Time.
    Set the date to a year ahead.
    Go back to the Home screen and open Passbook.
    Tap the App Store button. The App Store should load.
    Go back to Date & Time and turn on Set Automatically.
    Thanks to: https://discussions.apple.com/message/19622208#19622208

  • How does the newest Iphone work with Ford Sync?

    How does the new Iphone work with Ford Sync? I was thinking of purchasing the 4s but may go elsewhere if there is a better phone for the equipment in my vehicle.

    That would be a NO.. I should have done my homework before I switched to IPhone because the Bluetooth just does not want to sync with my Ford Truck. Its such an inconvience. But I see from other posts that Ford isn't the only car experiencing problems. So Hopefully Apple fixes this problem QUICKLY!

  • HT4914 How does the payment method work for iTunes Match?

    How does the payment method work with iTunes Match. For example, if you have a gift card, does it take it out of that. Or is there tax? What if you cancel your subscription in the middle of the year, does it take the money for that year or not? If someone could answer those questions it would be greatly apreciated. And if anyone has their own questions, feel free to ask. Thank you.

    Hi HLFrank,
    Welcome to Adobe Forum,
    You can opt for monthly payment in a yearly contract or pay at one go for an year.
    Please check the option at http://www.adobe.com/in/products/creativecloud/buying-guide.html
    Regards,
    Rajshree

Maybe you are looking for

  • Item is not relevant for Billing-VF 044

    Hello Experts, I have the scenario where i am doing Return Process.Here i have done it through scratch as in set the copy control for LR to RE ,with item category REN. The entire process was running fine till Post Goods Reciept. But when i am billing

  • Advantage and diff   btw Business service n business system

    hi, can anyone tell me the relevance n usage and importance of business system and business service, mean when do business service and business systems comes into picture respectively, thanks, pratibha

  • Start Workflow AFTER File Is Uploaded

    I want workflow to start AFTER i copy file through webdav (drag n drop). Now it starts workflow BEFORE file is uploaded. Workflow uses data from the file so the order is crucial. Is it possible?

  • Add a dimension

    Hi Experts, I am new to BPC and was just wondering if there will be any adverse affects if we add a dimension to an application while the BPC system is in the production mode.  Can it even be done?  If not, I would like to know if there is a work aro

  • Playing back Recorded TV Programs using Windows Media Player and only hearing Sound from Front Speakers

    Hi All, I have Windows 7 Ultimate 64-Bit Service Pack 1 with Windows Media Player 11 installed. When I click on one of my Recorded TV Programs to watch and hear, I can only hear the Sound coming from the Front Speakers. When I right-click on the Prog