[jboss-dev-forums] [jBPM Development] - Re: JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env)
suprit chaudhary
do-not-reply at jboss.com
Fri Jul 13 06:42:01 EDT 2012
suprit chaudhary [https://community.jboss.org/people/supritchaudhary] created the discussion
"Re: JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env)"
To view the discussion, visit: https://community.jboss.org/message/747970#747970
--------------------------------------------------------------
You need to start transaction by calling begin() on transactionManager before you call to create session JPAKnowledgeService.newStatefulKnowledgeSession.
*bitronix.tm.BitronixTransactionManager transactionManager= TransactionManagerServices.getTransactionManager();*
*transactionManager.begin();*
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newFileResource("test.bpmn"), ResourceType.BPMN2);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
Environment env = KnowledgeBaseFactory.newEnvironment();
env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
*env.set(EnvironmentName.TRANSACTION_MANAGER, tm);*
Properties properties = new Properties();
properties.put("drools.processInstanceManagerFactory","org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory");
properties.put("drools.processSignalManagerFactory","org.jbpm.persistence.processinstance.JPASignalManagerFactory");
KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/747970#747970]
Start a new discussion in jBPM Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2035]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120713/887d67e1/attachment.html
More information about the jboss-dev-forums
mailing list