AnsweredAssumed Answered

transaction example question (from user guide)

Question asked by beep02 on Mar 19, 2014
Latest reply on Mar 24, 2014 by jbarrez
    In the example:

    // here you can do transactional stuff in your domain model
    // and it will be combined in the same transaction as
    // the startProcessInstanceByKey to the Activiti RuntimeService

public class UserBean {

  /** injected by Spring */
  private RuntimeService runtimeService;

  @Transactional
  public void hello() {
   
    runtimeService.startProcessInstanceByKey("helloProcess");
  }
 
  public void setRuntimeService(RuntimeService runtimeService) {
    this.runtimeService = runtimeService;
  }
}

Question:
In the example:
Originated transaction started, once @Transactional encountered in the user bean.
Then Process transaction context taken from the originated transaction.

Is it working in opposite way, example:
Suppose we have a process instance, starting NOT in the bean, like in the example above,but that uses this UserBean from, say, some ServiceTask within the process.
Is transaction context taken from the process instance and used in the method call of UserBean?

Outcomes