Could you paste your unit test?
I'm trying to condense it into a smaller test case because of the large number of dependencies.
The error kept popping up after a svn update because the delete of a HistoryProcessInstanceImpl was not cascaded to the set of historyActivityInstances. I changed the Hibernate configuration in jbpm.history.hbm.xml for that part to this:
<set name="historyActivityInstances" cascade="all" inverse="true"> <key foreign-key="FK_HACTI_HPROCI" on-delete="cascade"> <column name="HPROCI_" index="IDX_HACTI_HPROCI"/> </key> <one-to-many class="HistoryActivityInstanceImpl" /> </set>