5 Replies Latest reply on Jul 12, 2006 5:41 AM by sgodden

    Best way of implementing pagination using JBPM

    harikrishna.yd

      Hi,

      I have been using JBPM for quite sometime. I have a usecase where the user can see all the tasklist instances in the UI. I have accomplished this using the API "JbpmTemplate.findTaskInstances()". Since the list of tasks can get huge, we started implementing pagination/sorting/filtering. I have seen the jbpm hibernate queries present in hibernate.queries.hbm.xml and it doesn't contain queries that supports pagination. This is the common scenario where everyone might have come across and tackled it in different ways. Oneway that came into my mind is writing named query and implementing it. Please let me know the best way of doing it.

      Thanks and Regards,
      Hari

        • 1. Re: Best way of implementing pagination using JBPM
          kukeltje

          it is only trivial if the queries can contain some ordered id (primary key, or date) and you do not want sorting based on e.g. taskname. It is not to difficult then to keep the last ID, or date and do a findTaskInstances(lastid, numberofrows) or something provided databases/hibernate support this. Getting the jsf datatable to use this is also not difficult. All other cases are not trivial.

          • 2. Re: Best way of implementing pagination using JBPM
            kukeltje

            btw, there is a Jira issue for this, so if someone did 'fix' this, please share and we'll incorporate it in the sourcecode

            • 3. Re: Best way of implementing pagination using JBPM

              Since many applications (including ours) need to store additional app-specific information abouts task instances, another solution is to have handlers on task-create and task-end which write out task instance information to your own data store (cross-referenced by task instance id).

              You can then implement whatever you want over that data store.

              I'm not saying that replaces what is already discussed in this thread - it's only an alternative.

              • 4. Re: Best way of implementing pagination using JBPM
                kukeltje

                that is always an issue. How to combine task data and own data. We (the company I work for) put the relevant info as metadata in the process, but limit this to one or two fileds

                • 5. Re: Best way of implementing pagination using JBPM

                  Yes I agree. So for instance we also put the FQCN and id of the object against which the process has been started as process variables, enabling all actions to know what they're working with.

                  But when taking it further, with lots of app-specific data against tasks which needs to be queried efficiently, we have an entity in the app filled by relevant actions on task-create etc. This avoids tight coupling between our app and jBPM.