• 4 replies
  • Latest Post - ‏2013-08-08T17:55:17Z by RickGentner
76 Posts

Pinned topic Record Locklng

‏2013-08-06T20:58:02Z |

I come from the IBM i background and have always had it easy when dealing with database record locking.

The web paradigm is very different from what I am used to and I am looking for advice on how to best handle record locks . 

In our application, we usually lock the top entity from updates by others if we are updating data owned by that entity.

So for example, say we have a member file and they have an associated claims accumulator file. When we are processing a claim for said entity, we lock the member record to prevent others from processing another claim simultaneously in order to avoid a collision in the accumulator file update.

Can this be achieved in the web programming or do I need to find another way of managing record locks.



Updated on 2013-08-07T15:25:16Z at 2013-08-07T15:25:16Z by RickGentner
  • Jerrycan
    28 Posts

    Re: Record Locklng


    In our application we still use the same mechanism as in our old RPG programs: write a lock-id (a flag) in our top entity. 
    So we do a record update with SQL to fill these fields. 
    That means that, if a user wants to edit a record, the first thing is locking the record. And after an update the record is unlocked.

    We also register these locks in a static class (Java) to do unlocks if users end their session without save the record or undo a record lock. 


    Greetings, Jeroen

  • RickGentner
    76 Posts

    Re: Record Locklng


    I have developed a small file to track the record locks for each file.

    I did this in order to avoid having to update all the database files with new fields. The web application I am developing is replacing a VRPG interface and therefore I want to minimize the disruption and changes required to the older interface.

    As a safety mechanism, the update process is coded to check that the last change time stamp of the record has not been altered since the record was locked.

    Preliminary testing indicates that this will work.

    I have not addressed the issues of orphaned record locks and am curious about your Java class solution.

    Can you provide more details on this?


  • dan_darnell
    973 Posts

    Re: Record Locklng


    Hi Rick,

    One question for you is what type of web applications you are developing...Rich UI or JSF? The underlying development models are very different.

    At this stage I only do Rich UI development ... my feeling being that JSF is older technology and not likely to progress any further (especially in EGL) while Rich UI (or, generically, "rich web") is state-of-the-art and where the investment is being made across the industry (with things like HTML5, PhoneGap, IBM Worklight, etc.) and in the EGL tooling.

    I think that web app design using Rich UI should embrace the notion of being stateless. Our apps use optimistic concurrency control. There is quite a bit of Internet "literature" on this and it can be completely implemented in EGL or, for that matter, in RPG. Check it out.









  • RickGentner
    76 Posts

    Re: Record Locklng


    RUI Development, I agree that this is way to go.

    That is the locking model I am trying to implement, just trying to verify my understanding of it.

    I am currently exploring the ROW CHANGE TOKEN functionality in the database to help ensure updates do not get overwritten.