jBPM is not aware of the current Hibernate session. It merely creates a new one if none is
set in the jbpmContext. The session returned by:
sessionFactory.getCurrentSession()
differs from the one in
jbpmContext.getSession()
unless you call
jbpmContext.setSession(sessionFactory.getCurrentSession())
before you do any persistent operation with the jbpmContext. Otherwise, the jbpmContext
opens a separate Hibernate session.
In your case it seems the current session remains open, while the jbpm-mantained session
has already been closed.
Note that when you inject an external session (with jbpmContext.setSession()) jBPM no
longer closes the session for you. This is definitely what you want in a managed
environment. Hibernate takes care of closing the session when the JTA transaction
completes.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3972683#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...