If you use jBPM in a managed environment, in your case from within an EJB3 bean, you have
to set the proper configuration parameters. Otherwise jBPM will delegate transaction
handling to Hibernate instead of enrolling in CMT.
See:
http://docs.jboss.org/jbpm/v3/userguide/persistence.html#thedbpersistence...
For jBPM to use managed transactions, it must be configured correctly in jbpm.cfg.xml and
hibernate.cfg.xml. In particular in jbpm.cfg.xml set the isTransactionEnabled attribute to
'false'. By setting isTransactionEnabled to false we are telling jBPM to NOT close
the hibernate session when the client calls jbpmContext.close(). This is important in a
managed environment, since we want hibernate to close the session only after the
transaction manager tells Hibernate that it has committed the transaction.
| <jbpm-context>
| <service name="persistence">
| <factory>
| <bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
| <field name="isTransactionEnabled"><false /></field>
| </bean>
| </factory>
| </service>
| </jbpm-context>
|
In hibernate.cfg.xml, you should set:
| <property
name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
|
| <property
name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
|
This will make jBPM work with container managed transactions.
In your hibernate.cfg.xml remove the property "jta.UserTransaction", as you are
enrolling in CMT.
Regards,
Martin
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033914#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...