cancel
Showing results for 
Search instead for 
Did you mean: 

ProcessInstanceComments for list of tasks

ivan_activiti
Champ in-the-making
Champ in-the-making
I have a list of about 300 tasks that I display in a table. For each task a user can add comments (which are added to the process on the backend). When I retrieve the list of tasks to display, before rendering this list I iterate it and retrieve comments by using:

List<Comment> comments = taskService.getProcessInstanceComments(task.getProcessInstanceId(), "comment");

Then I display the number of comments for each row, so users know if there is a comment for a specific process. The problem is that the ACT_HI_COMMENT table now has over 350,000 rows and it keeps growing, so the comment retrieval for a list of 300 tasks takes close to a minute.

Is there a better way to accomplish this?
2 REPLIES 2

ivan_activiti
Champ in-the-making
Champ in-the-making
I ended up taking a CustomSqlExecution direction. I left joined the ACT_HI_COMMENT table in my custom mapper select statement and it seems to work much faster now.

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Ivan,

Yes you can optimize the query. Another thing is that you have to archive history (History will keep growing….)

Regards
Martin