2 Replies Latest reply on May 9, 2012 1:47 AM by S Jegan

    GetTasksOwned API is not returning the claimed tasks as Task.createdBy_Id column is not updated

    S Jegan Newbie

      Hi All,

       

      Request you all to please help me on this. I am using jbpm 5.2. I use getTasksOwned API to get the tasks assigned to an user. It works fine in all scenarios except for the tasks that are claimed.

       

      What happens is, as part of the claim operation the "createdBy_id" column of Task is not getting updated. Because of this the query "TaskOwned" which is defined in TaskOrm.xml does not return the results. The "actualOwner_id" column is updated, but for some reason "createdBy_id" column is not.

       

      I tried going through the code and found that in commands method of TaskServiceSession.class, only actual owner is set. Is this an issue? If I manually update this column in db, it works.

       

      Is this an issue? If yes, is there any work-around for this? I am right now thinking of using the query API to get the tasks assigned. Will there be any other issue if I do that?

       

      Please provide your suggestions. Let me know if I need to provide any more information. Thanks for your time.

       

      Regards.

        • 1. Re: GetTasksOwned API is not returning the claimed tasks as Task.createdBy_Id column is not updated
          a_nat Newbie

          Hi,

           

          I think this is an expected behaviour. The created by column only gets populated if the task is created by a specific user. For all the tasks, which are created by the engine this will be empty.

           

          May I know the reason, why you want to update this?

           

          Regrads,

          Aparna

          • 2. Re: GetTasksOwned API is not returning the claimed tasks as Task.createdBy_Id column is not updated
            S Jegan Newbie

            Hi,

             

            Thanks for replying.

             

            Yes, this is an expected behavior as you have said. The real issue was Hibernate. I was using Hibernate 3.6.5, which generated a different query compared to the previous versions. After changing the TasksOwned query like below, it started working.

             

            select

                new org.jbpm.task.query.TaskSummary(

                t.id,

                t.taskData.processInstanceId,

                name.text,

                subject.text,

                description.text,

                t.taskData.status,

                t.priority,

                t.taskData.skipable,

                t.taskData.actualOwner,

                createdBy,

                t.taskData.createdOn,

                t.taskData.activationTime,

                t.taskData.expirationTime,

                t.taskData.processId,

                t.taskData.processSessionId)

            from

                Task t

                left join t.taskData.createdBy as createdBy...

             

            Sorry for not updating this here.

             

            Regards,

             

            Jegan