7 Replies Latest reply on Oct 29, 2009 7:35 AM by Joram Barrez

    Querying Against Process Variables

    Robert Moskal Newbie

      I'd like to get a list of running processes where a process variable has a certain value. The createProcessInstanceQuery doesn't support this. Can anyone suggest the simplest and or most idiomatic way to do this?

      Thanks and regards

      Robert Moskal
      Brooklyn, USA

        • 1. Re: Querying Against Process Variables
          Ronald van Kuijk Master

          Personally, I'd start by searching the forum (e.g. with its embedded search engine or maybe google), but that is just me...

          • 2. Re: Querying Against Process Variables
            Robert Moskal Newbie

            Ronald:

            You could interpret more charitably. I have indeed searched the forums and the length and breadth of the internet. Perhaps I need a custom hibernate query. Maybe somebody has already thought this through and would share it with the rest of us (saving me a bit of trouble). As I am happy to to do when I can help others.

            Thanks.

            Rob

            • 3. Re: Querying Against Process Variables
              Ronald van Kuijk Master

               

              "rmoskal" wrote:
              Ronald:

              You could interpret more charitably. I have indeed searched the forums and the length and breadth of the internet


              Next time, mention this. Nothing from your post gives me the intention you did. And since I'm pretty sure it has been discussed before multiple times, I posted what I posted.

              "rmoskal" wrote:

              . Perhaps I need a custom hibernate query. Maybe somebody has already thought this through and would share it with the rest of us (saving me a bit of trouble). As I am happy to to do when I can help others.

              That is indeed what has been discussed before, combined with the (dis)advantages, the usage of the businesskey etc... So sorry if you feel offended, next time add the information in this second post to the first one....Then you would have gotten a different response from me. Something like:

              Yes that is the way to go, or use the businesskey for this. Keep in mind that indexes might need to be created on each variable type column.

              • 4. Re: Querying Against Process Variables
                Robert Moskal Newbie

                No worries.

                businesskey, that was the key search term. So now hopefully we have a clearer connection between the two concepts.

                There were a few posts and that showed some hsql that worked with the TaskInstance class from 3.x. But no joy with the new 4.o domain objects.

                I see that we can get the execution from org.jbpm.pvm.internal.type.Variable. It should be easy enough. I was just looking for a shortcut.

                I will post the code when I'm done.

                Regards,

                Robert

                • 5. Re: Querying Against Process Variables
                  sdfsd sdfsd Newbie

                  I also need a solution for this..and yes I searched the forums. It would be greate if you could post some code. thx.

                  • 6. Re: Querying Against Process Variables
                    Ronald van Kuijk Master

                    The first question you always have to ask yourself: Is the businesskey sufficient. In many cases it is IF you separate your domain model from jBPM and just use a simple reference.

                    • 7. Re: Querying Against Process Variables
                      Joram Barrez Master

                      Ronald is right. In many cases, the business key is sufficient and even more appropriate to do queries. Do remember that business keys can have any string value, so with a bit of thinking chances are that you don't need additional variables.

                      Nonetheless, querying on variables is planned for a next release, but the approach will probably be way slower performance-wise compared to using the business key.