1 Reply Latest reply on Aug 7, 2009 10:32 AM by Ronald van Kuijk

    JBPM4, EJB, JPA and OpenEJB

    Matthew Herscovitch Newbie

      Hi All,

      Has anyone been able to get JBPM working is an EJB3 environment using JPA and deploying to JBoss but running unit tests in OpenEJB?

      We have an application that uses EJB3 and JPA to store data in an Oracle database. We are using jBPM4 to implement our workflows, and we have implemented a number of External Activitites that implement various additional functionality, including calling our EJBs (sometimes asynchronously). The jBPM workflows are being managed from within our EJBs, so that the call flow looks like:

      EJB -> jBPM -> External Activity -> EJB

      What we initially thought we could do is have jBPM share the JPA Hibernate Session. However, in jBPM4 it seems that this is not possible as we can only share the Hibernate SessionFactory.

      Our next approach was to configure jBPM to point to the same datasource as our EJB's JPA, and set Hibernate to use CMT. However this meant that the JobExecutor would fail because there was no CMT available.

      Finally, we tried setting Hibernate to use JTA and jBPM to use JTA, but the jBPM JTA code is JBoss-specific and so our integration tests, which run on OpenEJB, would not work.

      Does anyone have suggestions on how we might resolve these issues, or is there a better way to go about doing this?

      I notice that there is a similar looking JIRA issue, JBPM-2197, to further integrate the Environment and JTA, but it is not clear that this will help us.

      Thanks,

      Matt

        • 1. Re: JBPM4, EJB, JPA and OpenEJB
          Ronald van Kuijk Master

           

          "mherscov" wrote:
          What we initially thought we could do is have jBPM share the JPA Hibernate Session. However, in jBPM4 it seems that this is not possible as we can only share the Hibernate SessionFactory.
          Not possible *yet*.

          "mherscov" wrote:
          Our next approach was to configure jBPM to point to the same datasource as our EJB's JPA, and set Hibernate to use CMT. However this meant that the JobExecutor would fail because there was no CMT available.


          You could try running the JobExecutor in a separate environment


          "mherscov" wrote:
          Finally, we tried setting Hibernate to use JTA and jBPM to use JTA, but the jBPM JTA code is JBoss-specific and so our integration tests, which run on OpenEJB, would not work.


          In what way JBoss specific? Afaik, it should not be. Do you have examples of that

          "mherscov" wrote:
          Does anyone have suggestions on how we might resolve these issues, or is there a better way to go about doing this?


          Best way? At least filing a jira issue with the request to make it possible to inject hibernate sessions and gather votes. Better is to also supply a patch that makes it possible to inject hibernate sessions? Then we can most likely get that integrated.

          "mherscov" wrote:
          I notice that there is a similar looking JIRA issue, JBPM-2197, to further integrate the Environment and JTA, but it is not clear that this will help us.