6 Replies Latest reply on Mar 1, 2012 10:04 PM by andy.yeung

    Unable to getTasksAssigned in JBPM5

    andy.yeung

      Hi,  anybody know if the human task created on JBPM5 always have createdBy and actualOwner assigned? I just created a human task which assigned to a group. However I cannot retrieve the task through getTasksAssignedAsPotentialOwner. The named query "TasksAssignedAsPotentialOwnerByGroup" in the orm.xml generate a inner join to OrganizationEntity using the createdBy and actualOwner field, which in my case is null.

       

      My process definition first go through a script  task and then reach the human task which assign to a group.

      I have also tried the example process definition but the example just assigned to a single person, so I think the engine directly stored the actualOwner and createdBy.

        • 1. Re: Unable to getTasksAssigned in JBPM5
          salaboy21

          Can you check the human-tasks tests, I remember that there are some tests checking that particular situations. If you don't find any we will need to create them, but as far as I remember there were some test around the group assignments.

          https://github.com/droolsjbpm/jbpm/tree/master/jbpm-human-task/src/test/java/org/jbpm/task/service/

           

          Cheers

          • 2. Re: Unable to getTasksAssigned in JBPM5
            andy.yeung

            I found a group example in jbpm-examples. I found that the creator and actualowner is also null. I think that's by design since the user not yet pick up the task yet. I found that JBPM 5 is using hibernate 3.3. I will try to downgrade the hibernate version and see how's the SQL are generated. I guess the implicit join in the query t.taskData.createdBy and t.taskData.actualOwner force the hibernate engine to generate inner join statement.

            • 3. Re: Unable to getTasksAssigned in JBPM5
              andy.yeung

              Alright, confirmed the query work on hibernate 3.3. It seems that after hibernate 3.3, any implicit join syntax will trigger the additional inner join. I have tried 3.6.8 and 3.5.6 and both version added the additional inner join to the generated query.

              1 of 1 people found this helpful
              • 4. Re: Unable to getTasksAssigned in JBPM5
                andy.yeung

                By converting the query from

                 

                select

                     new org.jbpm.task.query.TaskSummary(

                     ...

                     t.taskData.actualOwner,

                     t.taskData.createdBy,

                     t.taskData.createdOn,

                     t.taskData.activationTime,

                     t.taskData.expirationTime)

                from

                    Task t

                    left join t.taskData.createdBy

                    left join t.taskData.actualOwner

                    left join t.subjects as subject

                    left join t.descriptions as description

                    left join t.names as name,

                    OrganizationalEntity potentialOwners

                where ...

                 

                to

                 

                select

                     new org.jbpm.task.query.TaskSummary(

                     ...

                    a,

                    c,

                     t.taskData.createdOn,

                     t.taskData.activationTime,

                     t.taskData.expirationTime)

                from

                    Task t

                    left join t.taskData.createdBy as c

                    left join t.taskData.actualOwner as a

                    left join t.subjects as subject

                    left join t.descriptions as description

                    left join t.names as name,

                    OrganizationalEntity potentialOwners

                where ...

                 

                Now I am able to get the correct query result.

                • 5. Re: Unable to getTasksAssigned in JBPM5
                  jbize

                  So I presume this is a bug... at least in that the latest version of jBPM is dependent on obsolete versions of Hibernate.

                   

                  But is it a bug in jBPM 5.2, or Hibernate 3.5+?

                   

                  Is there an updated Taskorm.xml that will work correctly with Hibernate 3.5+?

                   

                  If I replace all the createdBy and actualOwner instances in Taskorm.xml as specified above, is that sufficient to use Hibernate 3.5.Final?

                   

                  Thank you.

                  • 6. Re: Unable to getTasksAssigned in JBPM5
                    andy.yeung

                    Yes, I am now using Hibernate 3.6.9.Final and JBPM function correctly after I update the taskorm.xml.

                     

                    You can refer to https://hibernate.onjira.com/browse/HHH-4091 for details