I'm noticing some odd behavior with JBoss 2.4.4 on Linux when using the
CastorJDO plugin with Castor 0.9.3.9 and UserTransactions when calling a
BMP, BMT EJB. The requirements for the appliction I'm developing specify
the need to use UserTransactions to provide developers control over
The CastorJDO plugin tells Castor to make use of JBoss tx manager by
fetching it from java:/TransactionManager. This tells Castor to begin
and commit transactions based on the JBoss tx manager's tx contexts.
Here is the sequence that must take place from the client app that makes
calls to the EJB to perform database operations via Castor:
// fetch the EJB from JNDI
service = ServiceBroker.getFooService();
service.startSession(); // start a UserTx
... // do some work here using the EJB
service.endSession(); // commit the UserTx
For each business method that I execute inside of one of the above
sessions, there might be, say, three calls to Castor to perform database
operations (e.g. a finder method, a remover method, a creator method).
Anyway, upon tracking the tx contexts that Castor creates, they do not
correlate to each UserTx like I thought they would. I assumed that for
every UserTx that is started from the client app that it would correlate
one-to-one with a tx created by the JBoss tx manager. However, what I'm
seeing is very different. I'm seeing behavior that indicates that for
each call to Castor, the JBoss tx manager creates a tx. This causes
my app to fail with exceptions because the objects I'm removing are
not part of a transaction, and I think that this is due to the extra
transactions that are created. It's causing objects to be out of scope
of the tx. This behavior of creating extra transactions seems like more
a CMT model than a BMT model. Incidentally, I've also gotten around this
whole problem by using CMT. But I can't use CMT on this app.
Can anyone confirm that this behavior (the extra transactions) is either
correct or incorrect for BMT?
BTW, I am aware of this post/bug as well:
This bug has not been confirmed or denied and yet is it from Noveber 2001.