[jboss-user] [jBPM] - one of the ways to integrate JPA/Spring with jBPM

O S do-not-reply at jboss.com
Fri Apr 23 11:55:33 EDT 2010

O S [http://community.jboss.org/people/gelos] created the discussion

"one of the ways to integrate JPA/Spring with jBPM"

To view the discussion, visit: http://community.jboss.org/message/539262#539262

I tried to research this before on this forum and I don't think that there is a consensus on how to make jBPM to work seamlessly with JPA/Spring
We implemented an approach that works for us and I figured I will describe it here and see if there is any feedback from the community


- problem overview
  - when JPA/Spring is used the desire is to make jBPM to join JPA transactions seamlessly
  - the issue boils down to Hibernate sessions - how to inject sessions managed by Spring to jBPM
  - Spring manages EntityManagerFactory and EntityManager objects and a common approach (which we use) is to use @PersistenceContext() annotation in DAO objects and have Spring inject EntityManager instances (which are wrappers around Hibernate sessions) into DAOs
  - so we need to get a hold of EntityManager, get the underlying Hibernate session and provide it to jBPM when it asks for it

- solution overview
  - implement custom jBPM wire object for HibernateSession
  - in the object descriptor make a call to a bridge object that uses @PersistenceContext() and is managed by Spring and get Hibernate session from it every time jBPM needs it

see the attached files for details. code has comments in it


Reply to this message by going to Community

Start a new discussion in jBPM at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100423/34a30388/attachment.html 

More information about the jboss-user mailing list