This example shows how to use the JTA Begin and End block to do database rollback if DB Target activity throws Sql exceptions while loading the data into the database. Also it shows how to change the status of the flow to Abort.
- Put the JTA Begin and End as shown in the flow diagram. Double click on the DB Target activity and in the Properties Panel make the Error Level to 'File'. By using this option you can find the errors in the process flow logs Repository.
- Make the jtaEnlist to True. This will allow database rollback in case of any errors.
- Now right-click on the DB Target Activity and select "Invalid Data Exception Dialog" option. There paste the following statement >> service.setRollbackOnly();
- This will change the status of the process to "Abort" in case of any errors in the target activity.
- Process Flow logging level can be set to "Error" (which is default).
You can use the above approach in any flow.