DbSessionImpl.deleteProcessDefinitionHistory causes foreign key constrain violation for
FK_HACTI_HPROCI
-------------------------------------------------------------------------------------------------------
Key: JBPM-2970
URL:
https://jira.jboss.org/browse/JBPM-2970
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: jBPM 4.4
Environment: ubuntu 10.10, OpenJDK1.6
Reporter: Michael Wohlfart
Priority: Minor
DbSessionImpl.deleteProcessDefinitionHistory(String processDefinitionId) needs to remove
HistoryActivityInstanceImpl when deleting HistoryProcessInstanceImpl since there is a
foreign key constrain FK_HACTI_HPROCI in the hibernate mapping, the following
implementation should do the trick:
public void deleteProcessDefinitionHistory(String processDefinitionId) {
List<HistoryProcessInstanceImpl> historyProcessInstances = session
.createCriteria(HistoryProcessInstanceImpl.class)
.add(Restrictions.eq("processDefinitionId", processDefinitionId))
.list();
for (HistoryProcessInstanceImpl hpi : historyProcessInstances) {
List<HistoryActivityInstanceImpl> historyActivityInstances = session
.createCriteria(HistoryActivityInstanceImpl.class)
.add(Restrictions.eq("historyProcessInstance", hpi))
.list();
for (HistoryActivityInstanceImpl hai : historyActivityInstances) {
session.delete(hai);
}
session.delete(hpi);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira