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.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?
if you are going to use bean managed transaction there is no need to change the default transaction configuration as anyway it will use UserTransaction to manage transactions. So you are all good with default setup