Skip to main content
April 3, 2024
Question

com.appiancorp.rdbms.common.LockException: Could not write to the entities [XXXXXX] of data store "XXXXXXXXXXX", because the data is locked. (APNX-1-4180-00A)

  • April 3, 2024
  • 4 replies
  • 0 views

When DB Write to DS is giving locking issue saying it is Locked by some other process. Below is the error message.

com.appiancorp.rdbms.common.LockException: Could not write to the entities [XXXXXX] of data store "XXXXXXXXXXX", because the data is locked. (APNX-1-4180-00A): javax.persistence.OptimisticLockException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) : XXXXXXX

    4 replies

    davidc0742
    April 3, 2024

    As an learn I think "The error indicates another process is modifying the same data you're trying to write to in Data Store (DS). Investigate which process holds the lock and adjust accordingly (e.g. retry logic, code synchronization).

    harshitb6843
    April 3, 2024

    Check and see if your CDT has @Version annotation in it? I assume you have implemented locking via CDTs and someone else was making changes to the same table exactly at the same time as you. 

    April 3, 2024

    Yes, we are using Versioning. Is there is any way to overcome this issue in future. Other than removing versioning.

    harshitb6843
    April 3, 2024

    It would be to restrict two users somehow to edit the same screen at any given point of time. 

    You can do it via this plugin  - TextCahce on AppMarket. 

    With this, you can set the username of the user editing the interface in an interface-specific key, and in a local variable, check if the value of that key is null. If is null, no one is editing it and the user can edit, but if it is not null, then someone is editing that screen and hence, display a warning on the screen.