Question
Okahara
Last activity: 17 Jun 2018 20:54 EDT
Commit or roll back operation after update results on multiple tables
Hi,
We have multiple tables and want to commit after we make sure Pega is able to update / insert into all tables. If any of them fails for any reasons, then I want all tables to roll back. Let's say, we have following 2 classes:
Sandbox-Data-Customer (Customer table)
Sandbox-Data-Contract (Contract table)
In an activity, if I am able to update or insert into two of them successfully, I commit. If Customer table is updated but Contract table is for some reason unreachable and DML fails, then roll back.
#1. How would I implement such requirement?
#2. Does it make any difference if I am using Obj method or RDB method? In some scenario I would be using RDB method and need to make sure if it is still feasible.
Thanks,
HI,
** RDB operations are implicit commit, you have to handle rollback by delete query or updating old values.
Please check below if it helps for Obj-save:
*** please commit here any un-committed operations.
1. Save Sandbox-Data-Customer {On jump, check StepStatusGood. If true, Jump to 2 else Jump to 4}
2. Save Sandbox-Data-Contract {On Jump, check StepStatusGood. If true, Jump to 3 else Jump to 4}
3. Commit {If successful, Exit activity}
4. Rollback