1 Reply Latest reply on Feb 11, 2015 1:38 AM by Maciej Swiderski

    How to configure jbpm to use WebSphere CMT

    Steven Hu Newbie

      I read the user guider chapter 8 (Chapter 8. Persistence and Transactions). It says following must be done in order to use CMT transaction manager.

      1. Insert transaction manager and persistence context manager into environment prior to creating/loading session

      Environment env = EnvironmentFactory.newEnvironment();

      env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

      env.set(EnvironmentName.TRANSACTION_MANAGER, new ContainerManagedTransactionManager());

      env.set(EnvironmentName.PERSISTENCE_CONTEXT_MANAGER, new JpaProcessPersistenceContextManager(env));

       

      env.set(EnvironmentName.TASK_PERSISTENCE_CONTEXT_MANAGER, new JPATaskPersistenceContextManager(env));

      2. configure JPA provider (example hibernate and WebSphere)

      <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.CMTTransactionFactory"/>

      <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.WebSphereExtendedJTATransactionLookup"/>

       

      Now in my case, I develop an EJB to expose the jBPM interface: inside Kie-Web, first get RuntimeManager, and then get RuntimeEngine from RuntimeManager, next get KieSession or TaskService. finally use EJB wrap the KieSession/TaskService. As a consequence the client app directly call my EJB (why I do this is to overcome the performance issue of Remote REST java API). One limitation of my solution is the EJB must be Bean Managed Transaction.

      runtimeManager = RuntimeManagerRegistry.get().getManager(deploymentId);
      

       

      So I really don't know where to put the Environment parameters. can anyone help me?