Pessimistic locking
 

Pessimistic locking

5 posts, 0 answered
  1. Patrik Wikström
    Patrik Wikström avatar
    68 posts
    Registered:
    15 Oct 2018
    08 Apr 2019
    Link to this post
    What is the best way to achieve pessimistic locking using business entities in those rare cases you still need it? We solved one case by using a invokable method to update a access count, timestamp etc. needed to be updated frequently for our legacy code. Seems not so good to try and read and update in a loop, especially if you have a client which sends several calls for one client and you will end up racing against yourself.
  2. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    08 Apr 2019 in reply to Patrik Wikström
    Link to this post
    Can you please provide more details about your use-case?
  3. Patrik Wikström
    Patrik Wikström avatar
    68 posts
    Registered:
    15 Oct 2018
    08 Apr 2019
    Link to this post
    We have a legacy table that has to be updated on every call, especially with the last access timestamp which has some logic connected to it. The use of the invokable method solved this and we lock the record exclusively in the DA-layer in this use case. Just wondering if there could be more solutions to this.
  4. Mike Fechner
    Mike Fechner avatar
    319 posts
    Registered:
    14 Sep 2016
    08 Apr 2019 in reply to Patrik Wikström
    Link to this post
    I might be misunderstanding your use case, but 

    Patrik Wikström said:We have a legacy table that has to be updated on every call, especially with the last access timestamp which has some logic connected to it.


    But I would implement this using a Service (loaded via Services.xml file during AppServer startup and subscribing to the static Activated event of the Consultingwerk.OERA.ServiceInterface class. 

    But I don't see how that question relates to optimistic locking. 
  5. Patrik Wikström
    Patrik Wikström avatar
    68 posts
    Registered:
    15 Oct 2018
    09 Apr 2019 in reply to Mike Fechner
    Link to this post
    That is the place we are calling it from but calling it through a BE.
5 posts, 0 answered