How I'm doing this (bit hacky):
I have my own JbpmConfiguration implementation, where I control, how
JbpmContext is created.
I inject the thread local hibernate session object to JbpmContext.
Session object is resolved from entitymanager:
public JbpmContext createJbpmContext(String name) {
JbpmContext current = getCurrentJbpmContext();
JbpmContext context;
if(current != null) {
context = current;
} else {
context = super.createJbpmContext(name);
Session hibernateSession =
(Session)getEntityManagerFactory().createEntityManager().getDelegate();
context.setSession(hibernateSession);
}
Session hibernateSession = context.getSession();
if(hibernateSession.getTransaction().isActive()) {
getDoCommitStack().push(false);
} else {
hibernateSession.getTransaction().begin();
getDoCommitStack().clear();
getDoCommitStack().push(true);
}
return context;
}
Then you need to override jbpmContextClosed method too (to commit
transaction):
@Override
void jbpmContextClosed(JbpmContext jbpmContext) {
if(getDoCommitStack().isEmpty() || getDoCommitStack().pop()) {
try {
jbpmContext.getSession().getTransaction().commit();
} catch (StaleObjectStateException e) {
throw new JbpmPersistenceException("Exception while
commiting jbpmContext transaction", e);
} finally {
super.jbpmContextClosed(jbpmContext);
}
}
}
I hope that it is only temporary solution.
cvl
MikeSchulze wrote:
Hi bcornouiller
did you find a solution for your problem? If that's the case, I'd be interessted
in hearing something about it.
thx - Mike
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4195236#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...
_______________________________________________
jbpm-users mailing list
jbpm-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jbpm-users