2 Replies Latest reply on Jun 24, 2010 2:28 PM by Maciej Swiderski

    Join jBPM with Domain data

    Fabio Spiga Newbie

      Hello,

      I have a performance problem that seems to be quite standard.

      In my web-app, the domain data are for example DOCUMENTS.

      Each Document is bound to a jBPM instance.

      Both the domain and the jBPM tables are in the same database.

       

      When I list the personal tasks for a user, I would like to see in the same table both the domain data for the Document (type, referrer, size, ...) and the jBPM data (taskname, task priority, jbpm_ID, ...)

       

      So far, the only way I found to obtain these information is:

      1) to call findPersonalTasks() from jBPM API

      2) loop the Collection returned and, for each Task, call another query to get domain data about the Document related

      (or viceversa)

       

      This way is very heavy, is there a way to get these information by a single query?

      Or I have to change my data structure?

       

      Thanks,

      Fabio

        • 1. Re: Join jBPM with Domain data
          Michael Wohlfart Expert

          I am also looking for a good solution to this problem.

          What I am doing at the moment is keeping a field with the process instance id (dbid) in my domain object and use a custom hibernate query with a new constructor to dynamically create objects that contain the joined data from the jBPM task and the domain object.

          But this is pretty ugly since you have to do all the user and group checking which the findPersonalTasks() method is doing yourself inside the hql query, on the other hand you can do paging and result filtering.

          • 2. Re: Join jBPM with Domain data
            Maciej Swiderski Master

            You could do the opposite, meaning that jBPM process instance is the master. So you keep some domain data as process variable (document id, document name, etc) so task can present it quite easy without additional query to data base. If some one will decide to start work on the task then you load additional domain data.