[jboss-user] [jBPM] - Re: JBPM5, Spring, BTM and Tomcat

snyperboss do-not-reply at jboss.com
Wed Dec 7 05:04:58 EST 2011


snyperboss [http://community.jboss.org/people/snyperboss] created the discussion

"Re: JBPM5, Spring, BTM and Tomcat"

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

--------------------------------------------------------------
Hi,

This is how I create the session using the above spring configuration.

<pre><span style=' color: Blue;'>public</span> <span style=' color: Blue;'>static</span> StatefulKnowledgeSession createSession() <span style=' color: Blue;'>throws</span> Exception {

        <span style=' color: Green;'>/* 
         * Create the knowledgebase using the required bpmn and drl files 
         */</span> 
        KnowledgeBase kbase = readKnowledgeBase(<span style=' color: Maroon;'>"SampleHumanTaskFormVariables.bpmn"</span>); 
        <span style=' color: Green;'>//EntityManagerFactory emf = Persistence.createEntityManagerFactory( "org.jbpm.persistence.jpa" );</span> 



        EntityManagerFactory emf  = (EntityManagerFactory) HumanTaskStartupServlet.context.getBean(<span style=' color: Maroon;'>"entityManagerFactoryJbpmPersistanceJpa"</span>); 



        Environment env = KnowledgeBaseFactory.newEnvironment(); 
        env.set( EnvironmentName.ENTITY_MANAGER_FACTORY, emf ); 
        env.set( EnvironmentName.TRANSACTION_MANAGER, HumanTaskStartupServlet.context.getBean(<span style=' color: Maroon;'>"bitronixTransactionManager"</span>) ); 
        env.set( EnvironmentName.TRANSACTION, HumanTaskStartupServlet.context.getBean(<span style=' color: Maroon;'>"bitronixTransactionManager"</span>) ); 
        env.set( EnvironmentName.GLOBALS, <span style=' color: Blue;'>new</span> MapGlobalResolver() );

        Properties properties = <span style=' color: Blue;'>new</span> Properties(); 
        properties.put(<span style=' color: Maroon;'>"drools.processInstanceManagerFactory"</span>, <span style=' color: Maroon;'>"org.jbpm.persistence.processinstance.JPAProcessInstanceManagerFactory"</span>); 
        properties.put(<span style=' color: Maroon;'>"drools.processSignalManagerFactory"</span>, <span style=' color: Maroon;'>"org.jbpm.persistence.processinstance.JPASignalManagerFactory"</span>); 
        KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);

        <span style=' color: Blue;'>return</span> JPAKnowledgeService.newStatefulKnowledgeSession(kbase, config, env);

    } 
    </pre>

Thanks!
--------------------------------------------------------------

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

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/20111207/5e65eafe/attachment.html 


More information about the jboss-user mailing list