2 Replies Latest reply on Sep 8, 2006 11:10 AM by Andrew Bailey

    How to configure jbpm to use an extended persistence context

    Andrew Bailey Newbie

      I am trying to print out the processes defined in the JbpmContext
      and their nodes.

      I get the message

      failed to lazily initialize a collection of role: org.jbpm.graph.def.ProcessDefinition.nodes, no session or session was closed

      The bean
      public class ProcessManagerBean
      private Log logger;

      JbpmContext jbpmContext;

      private List processList;

      private ProcessDefinition process;

      private EntityManager em;
      //not used yet

      private List nodeList;

      public void findMessages()
      GraphSession graph = jbpmContext.getGraphSession();


      A fragment from the page is

      <h:dataTable id="someTable" var="proc" value="#{processList}" rendered="#{!empty processList}">
      <f:facet name="header">
      <h:outputText value="Name"/>
      <h:commandLink value="#{proc.name}" action="#{processManager.select}"/>

      <h3><h:outputText value="#{process.name}"/></h3>
      <h3><h:outputText value="#{process.nodes}"/></h3>

      The exception is caused by adding the last line

      My guess is that the jbpm session is not using an extended persistence context
      If thats the case how do I get it to use one.
      If not what is the problem.

      Andy Bailey

        • 1. Re: How to configure jbpm to use an extended persistence con
          Basel Al-Mustafa Newbie

          I am not that experience with Jbpm but to have Seam us an extended persistence context, add the following to faces-config.xml:


          Don't forget to remove the other PhaseListener, org.jboss.seam.jsf.SeamPhaseListener

          • 2. Re: How to configure jbpm to use an extended persistence con
            Andrew Bailey Newbie

            Thanks for the prompt reply but in this case it doesnt seem to be the answer, I already have those lines in the faces-config.xml

            I think jbpm handles its own connections to the datasource and I cant see how to get it to use an extended context.

            My temporary workaround is to load the process again in the current hibernate session using the name of the process.

            public void select()
            GraphSession graph = jbpmContext.getGraphSession();

            logger.info("ProcessDefinition "+process);
            //em.merge(process); this was my first try but the em is using a different configuration from jbpm and says that the class is not a persistent class
            if (process!=null)