JBoss Community

Re: Help using persistence with JBPM 5.4

created by doboss in jBPM - View the full discussion

Okay, I got it working by changing the code like this:

 

 


 @PersistenceUnit(unitName = "org.jbpm.persistence.jpa")
   private EntityManagerFactory emf;

   public void runIt()
   {
      try
      {
         if (kbase == null)
         {
            // load up the knowledge base
            kbase = readKnowledgeBase();
         }
         Environment env = KnowledgeBaseFactory.newEnvironment();
         env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

         // create a new knowledge session that uses JPA to store the runtime
         // state
         StatefulKnowledgeSession ksession = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, env);
         int sessionId = ksession.getId();
         JPAWorkingMemoryDbLogger logger = new JPAWorkingMemoryDbLogger(ksession);

 

 

If anyone wants more details, I would be happy to provide them.

Reply to this message by going to Community

Start a new discussion in jBPM at Community