Guido Helmers [
http://community.jboss.org/people/helmers] created the discussion
"How to provide my own transaction to jBPM?"
To view the discussion, visit:
http://community.jboss.org/message/536887#536887
--------------------------------------------------------------
Hi,
we're using jBPM 4.3, the jBPM tables are part of a bigger database schema, also
containing our own tables.
Our transactional service method looks like this:
@Transactional
public String create(Issue issue) {
// (1) (own stuff)
issueDao.persist(issue);
Map list =
taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
// ... etc
}
First we write some stuff to our own tables, then we tell jBPM to start a process. This is
all done within one transactional method (I was hoping...).
*jbpm.cfg.xml:*
*tx.hibernate.cfg.xml:*
*The problem...*
The problem is that jBPM creates its own transaction, and does not take part in the
transaction started by our own application (as you can see by writing an integration test
that succeeds on steps [1] and [2], but uses a mockTaskService to throw an exception at
[3] - what you see then is that our own tables are emptied (top-level transaction is
rolled-back), but JBPM4_HIST_PROCINST is still filled, in other words [2] is executed in
its own transaction and is not rolled back).
I tried to remove the "standard-transaction-interceptor" from
tx.hibernate.cfg.xml hoping that jBPM would magically participate in my own transaction,
but that doesn't make jBPM very happy.
Does anyone have an idea how I can tell jBPM to use my transaction, instead of starting
its own?
I read in the jBPM 4 developer's guide:
http://docs.jboss.org/jbpm/v4/devguide/html_single/#d0e2216
http://docs.jboss.org/jbpm/v4/devguide/html_single/#d0e2216
that +"User provided transasctional resources such as JDBC connections or hibernate
connections"+ is not yet available in jBPM4. I guess this feature is what I need...
is it already implemented or in the pipeline? Does anyone know when this feature will be
available, or if there is a workaround for it?
This post is related to my earlier post on the fact that jbpm4 does not use the hibernate
SessionFactory injected into it:
https://community.jboss.org/thread/150549?tstart=0
https://community.jboss.org/thread/150549?tstart=0
In the test project attached to that issue, you can also see how transaction management in
our application works... Perhaps the problem is solved as soon as the SessionFactory
injection issue is solved?
Cheers,
Guido
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/536887#536887]
Start a new discussion in jBPM Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]