does JavaDelegate executes inside a TX?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2013 07:23 AM
Got something like this:
if getSomeJpa().edit(pa); throws an exception will the execution variable be changed on the DB and the workflow go forward?
thanks in advance.
<serviceTask id="servicetask4" name="UpdateState" activiti:class="some.package.UpdateState"> </serviceTask>
public class UpdateState implements JavaDelegate { public void execute(DelegateExecution execution) throws Exception { … //update process vars execution.setVariable("approved", approved); execution.setVariable("sent", pa.isSent()); getSomeJpa().edit(pa); …. }
if getSomeJpa().edit(pa); throws an exception will the execution variable be changed on the DB and the workflow go forward?
thanks in advance.
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2013 07:55 AM
Yes, all code executed between two wait states (e.g.. process-start -> usertask or usertaks -> user task or signal -> end, …) is in a single transaction and IF there are no "async" steps in between. before an async step is executed, the transaction is committed and the next operation is queued as a job.
So if you have 2 service-tasks after each other, they'll be executed in the same transaction. If the second throws an exception, all stuff done in service-task1 will be rolled back as well. After this, the process is back in the state it was before the API call. In case of an exception when starting a new process-instance, there is no process started at all.
So if you have 2 service-tasks after each other, they'll be executed in the same transaction. If the second throws an exception, all stuff done in service-task1 will be rolled back as well. After this, the process is back in the state it was before the API call. In case of an exception when starting a new process-instance, there is no process started at all.
