1 Reply Latest reply on Sep 8, 2014 1:36 AM by swiderski.maciej

    Runtime Manager Types - JPAKnowledgeService

    jimmy.pannier

      Hi,

       

      I've got the jbpm6 developper guide book but there is something that i don't understand.

       

      My question is about the way in which the sessions are created.

       

      There is a chapter explaining the manager types (with code samples).

      - Singleton Runtime Manager

      - Per Request Runtime Manager

      - Per Process Instance Runtime Manager

      ---------> With the manager you get a runtime engine and with this engine you get a session with engine.getKieSession();

       

      There is also a chapter for implementing persistence and transaction. BUT the sample code for creation session is different

       

      KieServices services = KieServices.Factory.get();

      Environment newEnv = services.newEnvironment();

      newEnv.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);

      newEnv.set(EnvironmentName.TRANSACTION_MANAGER, tm);

      KieSession session = JPAKnowledgeService.newStatefulKnowledgeSession(kbase, null, newEnv);  ---> What about the runtime manager (which type) and environnement engine ?

        • 1. Re: Runtime Manager Types - JPAKnowledgeService
          swiderski.maciej

          there are number of ways how KieSession can be created. Recommended is via RuntimeManager as that hides quite a lot of boiler plate code required to setup persistence, various configuration etc. Although in some cases that might not be enough so direct session creation is desired and thus you can use JPAKnowledgeService to created ksession with persistence.

           

          HTH