For every workflow process I am creating a new separate kbase/ksession. So every flow is bound to a unique session and not shared.
I have enabled JPA persistence and pass in the following env to each new session:
env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
session = createNewSession(env)
session.startProcess(...)
I am getting Hibernate StaleObjectExceptions and OptimisticLocking errors when I perform multiple operations on different processes.
I am not sure what specific DB operation is causing this, but since each process is in its own KSession - how is this even possible?
What database update could be in contention between 2 threads in this case?
I am using jBPM5.2.
Any ideas???