4 Replies Latest reply on Aug 2, 2005 2:39 PM by dserodio

    JBPM 3.0 Documentation

    ramirini

      The 7.4 Chapter says that in order to get the database connection is necessary call to:
      Connection connection = ctx.getProcessInstance().getJbpmSession().getSession().getConnection();

      However the ProcessInstance object doesn't have the getJbpmSession method.

      How I can retrieve the JbpmSession?

      I am working with Jbpm 3.0

      Thanks!

        • 1. Re: JBPM 3.0 Documentation
          dserodio

          Try

          JbpmSession jbpmSession = JbpmSession.getCurrentJbpmSession();


          • 2. Re: JBPM 3.0 Documentation
            ramirini

            It doesn't work with

            JbpmSession jbpmSession = JbpmSession.getCurrentJbpmSession();

            The jbpmSession is null.

            I think that the JbpmSession Object should be retrieved from the ExecutionContext.

            Thanks!

            • 3. Re: JBPM 3.0 Documentation
              aguizar

              In order for JbpmSession.getCurrentJbpmSession() to return a valid session, the current thread should have opened a JbpmSession earlier via JbpmSessionFactory.openJbpmSession(). This is normally achieved by opening a session from the enclosing application, loading a token using that session and then signaling the token, so that the session is available for user-defined actions.

              • 4. Re: JBPM 3.0 Documentation
                dserodio

                Why? What other ways are there to create JbpmSessions besides "new JbpmSession(JbpmSessionFactory, Session)" and "JbpmSessionFactory.openJbpmSession()"?

                Or you mean that JbpmSession.getCurrentJbpmSession() will only return null if you never opened a JbpmSession (in the current thread, of course)?