0 Replies Latest reply on May 4, 2006 7:22 AM by elvioandrade

    CMT and Jbpm

    elvioandrade

      hi,

      i am trying to delegate the transactional behaviour of Jbpm on the container and for that I changed the jbpm.cfg.xml file to include:

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


      and the file hibernate.cfg.xml to:

       <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
       <property name="hibernate.connection.datasource">java:/jdbc/DefaultDS</property>
       <property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
       <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
      


      With this, I have Jbpm using my database and as it was said to me, the transactional behaviour should be left to jboss.

      From my understanding, any changes to my process definitions and process instances in the DB should be inserted in the transaction of the SSB that is using Jbpm. Starting from this, in my code and when saving processes to the DB, I did not made any JbpmContext.close() afterwards, but with this, nothing was being saved to the DB. Only with the explicit invocation of the close method, the processes are saved.

      On the other hand, if I close the context and then someting goes wrong and an exception is thrown or the setRollbackOnly method is invoked in the EJBContext, the processes are saved and that is not the desired behaviour. I want the processes to be saved if the container transaction commits and only in that case.

      This is my transaction specification in the DD:

       <assembly-descriptor>
       <container-transaction>
       <method>
       <ejb-name>Bean</ejb-name>
       <method-name>*</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
       </container-transaction>
       <container-transaction>
       <method>
       <ejb-name>Bean</ejb-name>
       <method-name>methodA</method-name>
       </method>
       <method>
       <ejb-name>Bean</ejb-name>
       <method-name>methodB</method-name>
       </method>
       <trans-attribute>RequiresNew</trans-attribute>
       </container-transaction>
       </assembly-descriptor>
      


      Maybe I am not seeing the thing right but I would appreciate any help.

      best regards