4 Replies Latest reply on Dec 20, 2006 2:43 PM by Tom Baeyens

    JTA integration

    Tom Baeyens Master

      There has been an email discussion about jBPM's JTA integration.

      I am referring to the fact that Hibernate needs to be flushed in beforeCompletion(), and closed in afterCompletion(), which is currently impossible because everything happens in the close() method.
      ________________________________

      From: Tom Baeyens
      Sent: Thursday, December 14, 2006 5:05 AM
      To: Gavin King
      Cc: Dev - jBPM
      Subject: RE: jBPM *still* unusable in JTA environment

      we have fixed this in head, but it is not yet backported to 3.1 branch.

      at least, if you are referring to the capability of using the hibernate current session.
      ________________________________

      From: Gavin King
      Sent: Thu 12/14/2006 6:25 AM
      To: Dev - jBPM
      Subject: jBPM *still* unusable in JTA environment

      Guys, when are we going to get this fixed? It's been a long time since I raised this really major issue.


      I now have added a configuration property to jBPM 3.1 to get this behaviour:

      a) when a jbpm needs a hibernate session, it uses SessionFactory.getCurrentSession()

      b) at jbpmContext.close(), jbpm does not do anything with the hibernate session. no flush and no close.

      Do you need the flush method to be exposed too ? Eventually i want to add it, but doing that in 3.1.x might be tricky.

        • 1. Re: JTA integration
          Jeff DeLong Master

          I am confused. I have used jBPM in a JTA environment since last March at least, using the following configuration in the jbpm.cfg.xml file:


           <service name="persistence">
           <factory>
           <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
           <field name="isTransactionEnabled"><false/></field>
           </bean>
           </factory>
           </service>
          
          


          With this configuration, the jbpmContext.close does not commit the transaction or close the Hibernate session.

          As for using the Hibernate session with jBPM, it would be nice for jbpm to use the sessionFactory.getCurrentSession() method. In the past I have injected the Hibernate session into jBPM using jbpmContext.setSession(s);


          • 2. Re: JTA integration
            Gavin King Master

            This is useful, I suppose, but is not really enough for Seam, since Seam is not using the "current" Hibernate session. What I really want to be able to do is pass a sesison to the method that creates a jbpm context. Yes, I also need the behavior that jBPM does not flush or close the session, or commit the transaction.

            • 3. Re: JTA integration
              Gavin King Master

              Or are you saying that you are using getCurrentSession() of the SF that you create internally.

              Ah, well, thats fine.

              But one of these days I would really like to be able to have a single persistence context for user entities and jBPM entities. Well, I guess its not as critical for now.

              • 4. Re: JTA integration
                Tom Baeyens Master

                if you want to use 1 session, you can inject it into the jbpmContext with the setSession(Session) method

                at the jbpmContext.close, the session is not going to be flushed or closed by jbpm.