Hi!
I was wondering, I so in the emergency demo application that the TaskServer retrieves the persistence file for the the task server to start like this:
emf = Persistence.createEntityManagerFactory("org.jbpm.task");
taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
In the persistence examples, I saw that actually we create the session with the persistence like this:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
If I am using persistence for the ksession, do I still need to start the TaskService with a new persistence,or the same persistence can be used for both like this:
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.drools.persistence.jpa");
taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);