I have an activity that is executed on a nightly basis. The activity loads data from one table in the PegaRULES database, does some processing, and then executes obj-save to 4 other application tables in the PegaRULES database.
When we execute 2 instances of the activity concurrently. It is creating duplicate records, meaning the tables have a column with a value, and there should only be one row for that particular value.
I looked at the locking features that can be configured at the class level.
But it seems to be locking at the record level and this would hamper the performance of the application. Is it possible to lock a table in the database.
Ideally, what we would like to do is to have 1 activity execute, and as it opens a record on a particular table, we would want to activate a lock on the table. So that when the 2nd concurrent activity is executed, it cannot write to the same table, but can only read from it, thus preventing creating duplicate records.
I can think of a way where you can use pr_sys_locks to manually put the lock and then when the write happen, delete that lock. The other activity first will check if lock exists, it will not do obj-save. Something like this. Just an idea.