2 Replies Latest reply on Apr 11, 2006 6:44 AM by Alessandro Schenone

    Getting a specific process instance

    Alessandro Schenone Newbie

      Hello all.

      Reading jBPM documentation, it seems that the are two ways to obtain a process instance.

      The first one is by its ID.

      The second one is by checking the value of one of its variable, cycling the whole list of the instances for a process definition.


      Are there others methods?


      In fact, in the first case, I must save the instance ID with the business object mapped by the process.

      In the second case, if the list is very long, I can have problems with performance.

      I'd like to have a Map where I can put and get elements by a key.

      Can anyone tell me something more about this issue?

      Thank you in advance.

      Ale.

        • 1. Re: Getting a specific process instance
          Alejandro Guizar Master

           

          The second one is by checking the value of one of its variable, cycling the whole list of the instances for a process definition [...] if the list is very long, I can have problems with performance
          .
          If you write a HQL query, you can have the backend database perform the "cycling" for you in a performant manner.
          I'd like to have a Map where I can put and get elements by a key.

          How does this relate to obtaining a process instance? Please clarify.

          • 2. Re: Getting a specific process instance
            Alessandro Schenone Newbie

            In order to use a HQL query, I have to know how jBPM persists the variables of a process instance.
            So I could ask instances for a specific business value.
            I'll try to have a closer look to documentation.

            For the idea of a Map...
            When I ask for the process instances with the last version of a process definition, now there is a method that returns a List.

            Creating a new process instance, it could be possible pass an Object as a key of the instance itself.

            So when I ask for the istances, I could have a Map and get the correct instance with the key I passed before.

            I don't know if there's a simple solution to do this.
            I'm only beginning to approach jBMP...