3 Replies Latest reply on Sep 30, 2009 6:26 AM by Andries Inzé

    jBPM4.1 - Spring 2.5.x - transactionManagement questions

    Christian Bonami Newbie

      Hi there,

      I've created a simple jBPM 4.1 process with 4 subsequent activities that each trigger a transactional service (@Service) that they're injected with.
      Obviously I've used Spring to configure jBPM and the services. I've used Andries Inzé's demo app to inspire me on how to do this.
      Different from Andries's demo, I make use of a Atomikos JTA transactionManager (platformTransactionManager), and not the Hibernate transaction manager.
      I would like every activity/service (based on JPA/Hibernate) to commit after it has been executed.

      I have 2 questions:
      - when using a single (JTA) transactionmanager for both jBPM and my JPA-services, the WHOLE process including ALL services are put in a single, atomic transaction block. When eg the 3th process fails, all previous services are rolled back too. This is not the desired behaviour for my app. Is this behaviour by design of jBPM/Spring integration?
      - when specifying 2 seperate transactionmanager beans (a Hibernate platformTransactionManager named 'transactionManager' linked to jBPM's sessionFactory, and a jtaPlatformTransactionManager named 'transactionManager.jta' and used by the entityManagerFactory and @Service objects), jBPM fails with a message saying that a platformTransactionManager could not be found. I thought that specifying 2 seperate transactionManagers would solve my problem, as jBPM processes would use thair own transaction(Manager), independent from services/transactions executed by member-activities.

      Or should I make use of the same transactionManager (JTA/Atomikos), but make jBPM and my services use different UserTransaction-s ? If this is the case, how do I specify that jBPM should make use of some specific userTransaction(-name)?
      And how should I specify that jBPM makes use of a particular transactionManager-bean in Spring, instead of the default bean with name 'transactionManager'?

      All help would be very welcome !!