Julian,
I throughly tested the spring-jbpm module. Rob Harrop told me its still a work in progress, but everything including transaction management is working quite well for me. I've tested JbpmTemplate transaciton intermingled with my domain specific HibernateTemplate transactions. Commits and rollbacks for all participating in the transaction are applied as you would expect.
I'm using hypersonic right now, looks like you're using postgres.
I'd like to see your implementation class, here's one I'm using to test writing a ProcessDefinition then retrieving a ProcessInstance
Code:
public class SimpleProcessPAOImpl implements SimpleProcessPAO {
private JbpmTemplate jbpmTemplate;
public ProcessDefinition createProcessDef(String xmlFileResource, final String processName) {
final ProcessDefinition myDefinition = ProcessDefinition.parseXmlResource(xmlFileResource);
myDefinition.setName(processName);
ProcessDefinition processDef = (ProcessDefinition)jbpmTemplate.execute(new JbpmCallback(){
public Object doInJbpm(JbpmSession jbpmSession) throws Exception {
GraphSession gSession = jbpmSession.getGraphSession();
gSession.saveProcessDefinition(myDefinition);
return myDefinition;
}});
return processDef;
}
public void setJbpmSessionFactory(JbpmSessionFactory jbpmSessionFactory)
{
jbpmTemplate = new JbpmTemplate(jbpmSessionFactory);
}
public ProcessInstance findProcessInstance(Long processId) {
return jbpmTemplate.findProcessInstance(processId);
}
public ProcessInstance createNewProcessInstance(ProcessDefinition def) {
ProcessInstance resultInstance = new ProcessInstance(def);
long instanceId = jbpmTemplate.saveProcessInstance(resultInstance);
return resultInstance;
}
}
I'm calling this code inside of a transaction kicked of by the AbstractTransactionalDataSourceSpringContextTests class from spring-mock. In another case, to really see the transaction boundaries, I'm calling this code inside of a TransactionTemplate.execute().