[jboss-user] [jBPM] - How to new a StatefulKnowledgeSession instance

RuiHua Tang do-not-reply at jboss.com
Wed Jun 29 04:43:20 EDT 2011


RuiHua Tang [http://community.jboss.org/people/trh3037] created the discussion

"How to new a StatefulKnowledgeSession  instance"

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

--------------------------------------------------------------
I have used JBPM5 in Spring Web Application

First, I use the following method to create:

       StatefulKnowledgeSession session = kbase.newStatefulKnowledgeSession();

But, I found that process data and session have not saved to the database


When I use the following methods:

EntityManagerFactory emf = (EntityManagerFactory) Constants.ctx
                                        .getBean("entityManagerFactory");
                    Environment env = KnowledgeBaseFactory.newEnvironment();
                    env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
                    env.set(EnvironmentName.GLOBALS, new MapGlobalResolver());
                    env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices
                                        .getTransactionManager());
                    // 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 session = JPAKnowledgeService
                                        .newStatefulKnowledgeSession(kbase, null, env);
                    // StatefulKnowledgeSession session =
                    // kbase.newStatefulKnowledgeSession();
                    return session;
--------------------------------------------------------------

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

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/20110629/cea5d13c/attachment.html 


More information about the jboss-user mailing list