[jboss-user] [jBPM] - TaskServer, persistence file and session

Odelya Holiday do-not-reply at jboss.com
Sun Feb 20 10:40:41 EST 2011


Odelya Holiday [http://community.jboss.org/people/odelyaholiday] created the discussion

"TaskServer, persistence file and session"

To view the discussion, visit: http://community.jboss.org/message/588542#588542

--------------------------------------------------------------
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);
 
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/588542#588542]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110220/b0e7aca1/attachment.html 


More information about the jboss-user mailing list