6 Replies Latest reply on Jun 3, 2010 5:27 AM by zhiyongcui

    Historytask query

      Is it possible to  create a historyTask query to find somebody's  history tasks of all versions of a specific process ?

        • 1. Re: Historytask query
          rebody

          Hi zhiyong,

           

          You could use plain hibernate api to query historytask. Just like this:

           

          session.createQuery("from org.jbpm.pvm.internal.history.model.HistoryTaskImpl").list()
          
          • 2. Re: Historytask query

            How to get session in jbpm4.1? Or how to use plain hql query in jbpm4?

            • 3. Re: Historytask query
              swiderski.maciej

              You can use HistoryTaskQuery with assignee as a condition.

               

              historyService.createHistoryTaskQuery().assignee("your user name").list();
              

               

              Next you can filter that based on execution id.

               

              If you want to use HQL you can either use hql activity in you process to fetch that information and set them as variable or write custom Command where you will be able to get hibernate session from environment.

               

              EnvironmentImpl.getFromCurrent().get(Session.class)
              

               

              HTH

              • 4. Re: Historytask query

                Thanks for you reply. But

                1. what I want to do  is filter  the  result based on the process definition.

                2. EnvironmentImpl.getFromCurrent().get(Session.class) seems could not get a hibernate session.

                • 5. Re: Historytask query
                  rebody

                  Hi zhiyong,

                   

                  search by process definition infor is more complicated.  Please there is no table for process definition, and the id, key, name, version column was stored in the deploy_prop table.  I am afraid you have to use lots of 'join' to achieve this.

                   

                  And if you want to get Session, please use this:

                   

                  EnvironmentImpl.getFromCurrent(Session.class);

                   

                  before using this, please make sure you have already open an Environment.

                  • 6. Re: Historytask query

                    Would you be pleased to give me a complete source code for open a hibernate session? I am a new user of jbpm4.