cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete a history activity node?

kim_zheng
Champ in-the-making
Champ in-the-making

请问一下如何删除ACT_HI_ACTINS中的一条记录,我并没有找到Activiti内部有提供相应的接口?

I would like to ask how to delete a record in ACT_HI_ACTINS, I did not find Activiti internal to provide the appropriate interface?

1 ACCEPTED ANSWER

cjose
Elite Collaborator
Elite Collaborator

I don't think there are APIs to delete a record from ACT_HI_ACTINST. You can use the delete methods in  HistoryService to delete a process or task instance which will in-turn delete all the associated records from respective tables including ACT_HI_ACTINST

Ciju

View answer in original post

10 REPLIES 10

cjose
Elite Collaborator
Elite Collaborator

I don't think there are APIs to delete a record from ACT_HI_ACTINST. You can use the delete methods in  HistoryService to delete a process or task instance which will in-turn delete all the associated records from respective tables including ACT_HI_ACTINST

Ciju

kim_zheng
Champ in-the-making
Champ in-the-making

thanks  for  your  answer Sincerely !!!  I have find another way to solve this problem . 

Hey Kim - Can you let us know what you did to resolve? It may be helpful to another user later! 

kim_zheng
Champ in-the-making
Champ in-the-making

i don't know  how to describe the process, so i will show the code directly . hope it will help another user.

  •     first  you need  a  mapper interface  

            public interface HistoryActivitiInstanceMapper {

                     @Delete(" delete from act_hi_actinst where ID_ = #{id}")
                     public Integer deleteHistoricActivitiInstanceById(String id);

             }

  •   second  define custom  SqlExecution use the mapper interface that you have    

      CustomSqlExecution<HistoryActivitiInstanceMapper, Integer> sqlExecution =

                  new AbstractCustomSqlExecution<HistoryActivitiInstanceMapper, Integer>(HistoryActivitiInstanceMapper.class) {
                     @Override
                        public Integer execute(HistoryActivitiInstanceMapper mapper) {
                                          return mapper.deleteHistoricActivitiInstanceById(currentId);
                     }
         };

  •    third  delete the HistoricActivityInstance by ID_
         managementService.executeCustomSql(qlExecution);