Dan Allen wrote:
Of course, then you must have Seam doing all calls to jBPM or else
you
will be outside of a transaction. I'm unaware of whether this was
considered (not saying it wasn't). That explains, though, why Seam has
the workInTransaction callbacks.
This is the configuration we are using
<service name="persistence">
<factory>
<bean
class="org.jbpm.persistence.jta.JtaDbPersistenceServiceFactory">
<field name="isTransactionEnabled"><false/></field>
<field
name="isCurrentSessionEnabled"><true/></field>
</bean>
</factory>
</service>
This is similar to the seam configuration except that the
JtaDbPersistenceServiceFactory will create a JTA transaction if one does
not already exist.
The specific issue we are seeing relates more to the hibernate behaviour
rather than explicit jBPM behaviour. The configuration in SOA is such
that we end up using a JTASessionContext within hibernate and this is
configured to close the session when the transaction terminates. Any
subsequent transaction usage on the same session, or even manipulation
of the objects outside of the transaction, will result in the following.
When running a seam example on the SOA platform we were seeing
an
exception being thrown as a result of a hibernate session being used
after it has previously been closed, this was a SessionException with
the text "Session is closed!".
The seam integration can reuse the same jBPM context in different
transactions and also pass the hibernate objects outside of the
transaction. Both of these scenarios result in unusable context and/or
hibernate objects within the SOA environment.
Kev
BTW The two instances of passing objects outside of the transaction
boundary were found in ProcessInstance and TaskInstance. Wrapping the
invocation from Contexts created a transaction that also encompassed the
method invocations on those objects.
--
JBoss, a Division of Red Hat
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire,
SI4 1TE, United Kingdom.
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (USA), Charlie Peters (USA), Matt Parsons
(USA) and Brendan Lane (Ireland)